1515 MORTON_CODE_VALUE_MAX ,
1616)
1717
18+
1819def is_sorted (l ):
1920 return all (l [i ] <= l [i + 1 ] for i in range (len (l ) - 1 ))
2021
22+
2123data_path = Path ('tests/data' )
2224
25+
2326@pytest .fixture
2427def sdata_with_points ():
2528 sdata = read_zarr (data_path / "xenium_rep1_io.points_only.spatialdata.zarr" )
@@ -59,7 +62,7 @@ def test_zorder_query(sdata_with_points):
5962 sdata_morton_sort_points (sdata , "transcripts" )
6063
6164 # Query a rectangle that should return some points
62- orig_rect = [[50.0 , 50.0 ], [100.0 , 150.0 ]] # x0, y0, x1, y1
65+ orig_rect = [[50.0 , 50.0 ], [100.0 , 150.0 ]] # x0, y0, x1, y1
6366 matching_row_ranges , rows_checked = sdata_morton_query_rect_debug (sdata , "transcripts" , orig_rect )
6467 rect_row_indices = row_ranges_to_row_indices (matching_row_ranges )
6568
@@ -98,7 +101,7 @@ def test_zorder_query(sdata_with_points):
98101
99102 # Check that the number of rows checked is less than the total number of points
100103 assert len (rows_checked ) <= 19858
101- assert len (matching_row_ranges ) == 2 # Kind of an implementation detail.
104+ assert len (matching_row_ranges ) == 2 # Kind of an implementation detail.
102105
103106 # Do a second check, this time against x_uint/y_uint (the normalized coordinates)
104107 # TODO: does this ensure that estimated == exact?
@@ -130,9 +133,9 @@ def test_zorder_query(sdata_with_points):
130133
131134 assert len (exact_row_indices_norm ) == 4
132135 assert len (estimated_row_indices ) <= 4
133-
136+
134137 # ========= Another query ==========
135- orig_rect = [[500.0 , 500.0 ], [600.0 , 600.0 ]] # x0, y0, x1, y1
138+ orig_rect = [[500.0 , 500.0 ], [600.0 , 600.0 ]] # x0, y0, x1, y1
136139
137140 # Query using z-order
138141 matching_row_ranges , rows_checked = sdata_morton_query_rect_debug (sdata , "transcripts" , orig_rect )
@@ -159,7 +162,7 @@ def test_zorder_query(sdata_with_points):
159162
160163 # Check that the number of rows checked is less than the total number of points
161164 assert len (rows_checked ) <= 71675
162- assert len (matching_row_ranges ) == 13 # Kind of an implementation detail.
165+ assert len (matching_row_ranges ) == 13 # Kind of an implementation detail.
163166
164167 # Do the same query the "dumb" way, by checking all points
165168 in_rect = (
@@ -197,5 +200,3 @@ def test_zorder_query(sdata_with_points):
197200 # Check that the estimated rows contain all of the exact rows.
198201 assert len (exact_row_indices_norm ) == 91
199202 assert len (estimated_row_indices ) <= 95
200-
201-
0 commit comments