diff --git a/docs/source/conf.py b/docs/source/conf.py index 9fae80c..c520a55 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -14,6 +14,7 @@ # import os # import sys # sys.path.insert(0, os.path.abspath('.')) +import warnings import os from datetime import datetime as dt @@ -67,7 +68,6 @@ # Suppress known deprecation warnings from dependencies # astroid 4.x deprecation - will be fixed when sphinx-autoapi updates for astroid 5.x -import warnings warnings.filterwarnings( 'ignore', message="importing .* from 'astroid' is deprecated", @@ -180,9 +180,9 @@ def _validate_reference_urls(urls, timeout=5): # Sphinx gallery configuration sphinx_gallery_conf = { - 'examples_dirs': '../../examples', - 'gallery_dirs': 'auto_examples', - 'within_subsection_order': 'NumberOfCodeLinesSortKey', - 'reference_url': _validate_reference_urls(_reference_urls), - 'default_thumb_file': os.path.join(os.path.dirname(__file__), '..', '_static', 'trx_logo.png'), + 'examples_dirs': '../../examples', + 'gallery_dirs': 'auto_examples', + 'within_subsection_order': 'NumberOfCodeLinesSortKey', + 'reference_url': _validate_reference_urls(_reference_urls), + 'default_thumb_file': os.path.join(os.path.dirname(__file__), '..', '_static', 'trx_logo.png'), } diff --git a/trx/tests/test_memmap.py b/trx/tests/test_memmap.py index aae8452..fb6cdec 100644 --- a/trx/tests/test_memmap.py +++ b/trx/tests/test_memmap.py @@ -498,6 +498,117 @@ def test__ensure_little_endian_big_endian_input(): assert result[0] == 0x12345678 +def test_load_zip64_with_extra_fields(): + """Test loading ZIP64 files where both local and CD headers have extra fields. + + Rust and other tools always write ZIP64 extended information (extra field + ID 0x0001, 20 bytes: 4-byte tag+size + 8-byte orig + 8-byte comp) in both + local file headers and central directory entries, even for small files. + This ensures the data offset is computed correctly by reading the local + header's extra_len rather than assuming a fixed layout. + """ + positions = np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]], dtype=np.float32) + offsets = np.array([0, 2], dtype=np.uint64) + header = { + "DIMENSIONS": [10, 10, 10], + "VOXEL_TO_RASMM": np.eye(4).tolist(), + "NB_VERTICES": 2, + "NB_STREAMLINES": 1, + } + + def make_zip64_extra(orig_size, comp_size): + data = struct.pack("