import json from bookmark.config import AppConfig def test_load_config_from_json(tmp_path): config_data = { "device_index": 0, "catalogue_path": str(tmp_path / "catalogue.csv"), "captures_dir": str(tmp_path / "captures"), "reference_frame_path": str(tmp_path / "reference.jpg"), "markers": [ {"name": "small_boundary", "bucket": "small", "x": 0, "y": 0, "width": 10, "height": 10}, ], "guide_box": [20, 20, 60, 60], "trigger_strategy": "manual", } config_path = tmp_path / "config.json" config_path.write_text(json.dumps(config_data)) config = AppConfig.load(config_path) assert config.device_index == 0 assert config.trigger_strategy == "manual" assert config.guide_box == (20, 20, 60, 60) assert len(config.markers) == 1 assert config.markers[0].bucket == "small"