"""quant_formats.py --hf reads each shard's header over HTTP range requests with gguf_reader's bounds checks (#5075): the header knows the file's size from the Hugging Face tree, so a complete header parses and a cut one is refused with a ValueError that names the file. Over a minimal GGUF v3 header written here (no network, no model). python -m unittest tools.test_quant_formats_hf """ from __future__ import annotations import io import json import re import struct import sys import unittest from pathlib import Path from unittest import mock sys.path.insert(0, str(Path(__file__).resolve().parent)) import quant_formats as Q # noqa: E402 def gstr(s: bytes) -> bytes: return struct.pack(" bytes: """One Q8_0 [32, 4] tensor `blk.0.ffn_down_exps.weight` (type 8), data at offset 0 after a 32-byte alignment.""" head = struct.pack("