"""Synthetic tests for tools/anim_move.py (ASSET-86). python -I -m unittest tests/test_anim_move.py -v Every byte here is built synthetically by the test: single-stream and 64 KiB-split multi-stream MoVE v19 containers with request/flag/5-byte descriptor preambles, Type 1 (StateMachine), Type 3 (InlinedStateMachine), and Type 22 (MotionTree) hierarchies, outgoing and default transitions, and length-prefixed parameter blocks. No game file or game asset name is used. """ import json import os import struct import subprocess import sys import tempfile import unittest from unittest import mock ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) TOOL = os.path.join(ROOT, "tools", "anim_move.py") sys.path.insert(0, os.path.join(ROOT, "tools")) sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) import anim_move # noqa: E402 from anim_index import MAX_CHUNK, joaat32 # noqa: E402 from test_anim_clips import write_rpf # noqa: E402 HASH_SM = joaat32("statemachine") HASH_MT = joaat32("motiontree") def build_transition(target_rel_from_48, cond_kind=1, extra_cond_words=(0x11110001,)): """Build an outgoing state transition record (`u32 size` at +0x10, `i32 target_rel` at +0x48).""" extra = b"".join(struct.pack(" 0) def test_module_docstring_has_no_double_encoded_characters(self): """The preamble layout uses U+00D7; it was once stored as the pair U+00C3 U+2014.""" with open(TOOL, encoding="utf-8") as f: source = f.read() for broken in ("\u00c3\u2014", "\u00e2\u20ac", "\u00c2"): self.assertNotIn(broken, source) self.assertIn("N_req \u00d7 u32 request hashes", source) if __name__ == "__main__": unittest.main()