"""setup.check_shards: a metadata-only GGUF shard that ends at its header (no alignment padding, #2346) is whole; a shard whose tensor data runs past its end is still refused, including inside an integer tensor.""" import struct import sys import tempfile import unittest from pathlib import Path ROOT = Path(__file__).resolve().parent.parent sys.path.insert(0, str(ROOT)) import setup # noqa: E402 # ggml type id -> bytes per value, for the unquantised types these tests write VALUE_BYTES = {0: 4, 27: 8} # F32, I64 def _str(s): b = s.encode() return struct.pack("