"""Scanner -> format_response flow tests for the quantization field.""" from __future__ import annotations import hashlib import io import json import os import struct from pathlib import Path from typing import List import pytest from py.services import model_scanner from py.services.checkpoint_scanner import CheckpointScanner from py.services.checkpoint_service import CheckpointService from py.services.model_scanner import ModelScanner @pytest.fixture(autouse=True) def reset_model_scanner_singletons(): ModelScanner._instances.clear() ModelScanner._locks.clear() yield ModelScanner._instances.clear() ModelScanner._locks.clear() def _normalize(path: Path) -> str: return str(path).replace(os.sep, "/") def _write_gguf(path: Path, file_type: int) -> None: """Write a minimal GGUF file whose general.file_type is ``file_type``.""" blob = io.BytesIO() blob.write(b"GGUF") blob.write(struct.pack("