@@ -128,56 +128,6 @@ def test_shard_index_localize_chunk() -> None:
128128 assert index ._localize_chunk ((4 , 6 )) == (0 , 0 ) # 4 % 2 = 0, 6 % 3 = 0
129129
130130
131- def test_shard_index_is_dense_true () -> None :
132- """Test is_dense returns True when chunks are contiguously packed."""
133- index = _ShardIndex .create_empty ((2 ,))
134- chunk_byte_length = 100
135-
136- # Set chunks contiguously: [0-100), [100-200)
137- index .set_chunk_slice ((0 ,), slice (0 , 100 ))
138- index .set_chunk_slice ((1 ,), slice (100 , 200 ))
139-
140- assert index .is_dense (chunk_byte_length ) is True
141-
142-
143- def test_shard_index_is_dense_false_duplicate_offsets () -> None :
144- """Test is_dense returns False when chunks have duplicate offsets."""
145- index = _ShardIndex .create_empty ((2 ,))
146- chunk_byte_length = 100
147-
148- # Set both chunks to same offset (duplicate)
149- index .set_chunk_slice ((0 ,), slice (0 , 100 ))
150- index .set_chunk_slice ((1 ,), slice (0 , 100 ))
151-
152- assert index .is_dense (chunk_byte_length ) is False
153-
154-
155- def test_shard_index_is_dense_false_wrong_alignment () -> None :
156- """Test is_dense returns False when chunks are not aligned to chunk_byte_length."""
157- index = _ShardIndex .create_empty ((2 ,))
158- chunk_byte_length = 100
159-
160- # Set chunks not aligned: [0-100), [150-250)
161- index .set_chunk_slice ((0 ,), slice (0 , 100 ))
162- index .set_chunk_slice ((1 ,), slice (150 , 250 ))
163-
164- assert index .is_dense (chunk_byte_length ) is False
165-
166-
167- def test_shard_index_is_dense_with_empty_chunks () -> None :
168- """Test is_dense handles empty chunks correctly."""
169- index = _ShardIndex .create_empty ((3 ,))
170- chunk_byte_length = 100
171-
172- # Only set first and third chunk, skip middle
173- index .set_chunk_slice ((0 ,), slice (0 , 100 ))
174- # (1,) is empty
175- index .set_chunk_slice ((2 ,), slice (100 , 200 ))
176-
177- # Should still be dense since only non-empty chunks are considered
178- assert index .is_dense (chunk_byte_length ) is True
179-
180-
181131# ============================================================================
182132# _load_partial_shard_maybe tests
183133#
0 commit comments