"""Game-free checks of nx2/prompt_assets.py pc_texts, the texts that name the console in the PC's words, on an authored archive (no game text): python -I -B tests/test_pc_texts.py An edit rewords one string in its own room: the archive keeps its size, the string keeps its tags, and nothing else changes. A string that is not a wording the edits know is left as it is. The file is the title's (title_messages), which host/prompts.c serves only where no mod has it (host/mods.c).""" import importlib.util import struct import sys import unittest from pathlib import Path ROOT = Path(__file__).resolve().parents[1] sys.path.insert(0, str(ROOT / "nx2")) # (prompt_assets imports prompt_faces beside it) spec = importlib.util.spec_from_file_location("prompt_assets", ROOT / "nx2" / "prompt_assets.py") T = importlib.util.module_from_spec(spec) spec.loader.exec_module(T) TAG = b"\x0e\x01\x00\x04\x00\x02\x00\x17\x00" # (a control tag with a NUL in it: a string does not end at the first NUL) def msbt(strings): """An authored UTF-8 MSBT: strings is [(label, bytes)]""" labels = struct.pack("is_dir) return hos_prompts_romfs(key, out, cap);", mods) # (only where no mod has the file) source = (ROOT / "nx2" / "prompt_assets.py").read_text(encoding="utf-8") self.assertIn("worded, said, left = pc_texts(new or game)", source) # (in the title's file: one file a language) if __name__ == "__main__": unittest.main()