From 8a84699ee052b094f403c7470134af0c768becb3 Mon Sep 17 00:00:00 2001 From: Scott Boudreaux Date: Wed, 20 May 2026 15:56:50 -0500 Subject: [PATCH] TEST: build the ZIP fixture little-endian in the local-header test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test_load_zip_with_local_header_extra_field hand-builds a ZIP and wrote the positions/offsets arrays with `.tobytes()`, which serializes in native byte order. The TRX format stores arrays little-endian on disk (see `_get_dtype_little_endian` / `_ensure_little_endian`), and the reader decodes them little-endian — so on a big-endian host (s390x) the fixture wrote big-endian bytes that the reader then byte-swapped, and the test failed with mismatched values. Serialize the fixture arrays explicitly as little-endian (`astype(" --- trx/tests/test_memmap.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/trx/tests/test_memmap.py b/trx/tests/test_memmap.py index 21451a4..1436a1b 100644 --- a/trx/tests/test_memmap.py +++ b/trx/tests/test_memmap.py @@ -523,10 +523,12 @@ def test_load_zip_with_local_header_extra_field(): local_info = [] extra = b"\x00\x00\x04\x00TEST" # 8-byte extra field + # TRX stores arrays little-endian on disk; serialize the fixture + # explicitly so it is valid on big-endian hosts too (issue #113). for name, data in [ ("header.json", json.dumps(header).encode()), - ("positions.3.float32", positions.tobytes()), - ("offsets.uint64", offsets.tobytes()), + ("positions.3.float32", positions.astype("