"""Hand-built descriptor and BVH streams for tools/bvh_groups.py. No game data is read. python -I tests/test_bvh_groups.py """ import contextlib import io import json import os import struct import sys import tempfile import unittest import zlib from unittest import mock ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, os.path.join(ROOT, "tools")) import bvh_groups # noqa: E402 import bvh_index # noqa: E402 import report_paths # noqa: E402 def a16(n): return (n + 15) & ~15 def blas(n, pad=0): """A BVH4 stream wrapper: 0x100 bytes, the 64-byte header at 0x100, n nodes, then `pad` zero bytes.""" end = 0x140 + 64 * n b = bytearray(end + pad) struct.pack_into("