"""Validate binary capture adjacency without optional image-analysis packages.""" import importlib.util from pathlib import Path import struct import subprocess import sys import tempfile import unittest SCRIPT = Path(__file__).resolve().parents[1] / "scripts" / "framelog.py" spec = importlib.util.spec_from_file_location("framelog", SCRIPT) log = importlib.util.module_from_spec(spec) spec.loader.exec_module(log) class CaptureTests(unittest.TestCase): def setUp(self): self.folder = tempfile.TemporaryDirectory(prefix="hookshot-framelog-") self.addCleanup(self.folder.cleanup) self.path = Path(self.folder.name) / "frames.rgba" def capture(self, sequences, timestamps=None, kinds=None): timestamps = timestamps if timestamps is not None else range(1, len(sequences) + 1) kinds = kinds if kinds is not None else [0] * len(sequences) with self.path.open("wb") as file: for t, s, k in zip(timestamps, sequences, kinds): file.write(struct.pack("