"""Synthetic structural fixtures; no retail game bytes.""" from pathlib import Path import struct import sys import unittest sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'tools')) from inspect_disc_inventory import inspect, typed_members, mips_shapes class TypedArchiveTest(unittest.TestCase): def fixture(self): data = bytearray(3 * 32) struct.pack_into('<6I', data, 0, 2, len(data), 7, 5, 7, 31) data[32:37] = b'first' data[64:95] = b'z' * 31 return data def test_duplicate_types_and_partial_sectors(self): members = typed_members(self.fixture(), 32) self.assertEqual([(m['kind'], m['offset'], len(m['body'])) for m in members], [(7, 32, 5), (7, 64, 31)]) def test_reject_size_count_and_extent_errors(self): for offset, value in [(0, 4), (4, 95), (12, 90), (20, 33)]: with self.subTest(offset=offset): data = self.fixture() struct.pack_into('