Skip to content

Commit

Permalink
WIP update
Browse files Browse the repository at this point in the history
  • Loading branch information
ihnorton committed Mar 28, 2022
1 parent b93c247 commit 043fbef
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
11 changes: 6 additions & 5 deletions tiledb/tests/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ def bounded_anytuple(draw, *, min_value=0, max_value=10):

@composite
def ranged_slices(draw, min_value=0, max_value=10):
bdd = st.one_of(st.none(), st.integers(min_value=min_value, max_value=max_value))
start = draw(bdd)
stop = draw(bdd)
step = draw(bdd)
bdd = st.integers(min_value=min_value, max_value=max_value)
start = draw(bdd.filter(lambda x: x != None))
stop = draw(bdd.filter(lambda x: x != None))
start,stop = sorted((start,stop))
#step = draw(bdd)

return slice(start, stop, step)
return slice(start, stop, None)
22 changes: 16 additions & 6 deletions tiledb/tests/test_multi_index-hp.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,24 @@ def write_dense(uri):
bounded_anytuple(min_value=0,max_value=99),
bounded_anytuple(min_value=1,max_value=100)
)
def test_ref_2d_slicing(self, dense_array_2d, r1, r2):
def test_ref_2d_points(self, dense_array_2d, pts1, pts2):
a1_legacy, a1_ref = dense_array_2d

assume((r1,r2) != ((0,),(71, 1, 72)))
assume((r1,r2) != ((0,),(1,3,2)))

#print(r1,r2)
np.testing.assert_array_equal(
a1_legacy.multi_index[list(r1),list(r2)]["a1"],
a1_ref.multi_index[list(r1),list(r2)]["a1"]
a1_legacy.multi_index[list(pts1),list(pts2)]["a1"],
a1_ref.multi_index[list(pts1),list(pts2)]["a1"]
)

@given(
st.lists(ranged_slices(min_value=0, max_value=99)).filter(lambda x: x != []),
st.lists(ranged_slices(min_value=1,max_value=100).filter(lambda x: x != []))
)
def test_ref_2d_slicing(self, dense_array_2d, ranges1, ranges2):
a1_legacy, a1_ref = dense_array_2d

#print(ranges1, ranges2)
np.testing.assert_array_equal(
a1_legacy.multi_index[list(ranges1),list(ranges2)]["a1"],
a1_ref.multi_index[list(ranges1),list(ranges2)]["a1"]
)

0 comments on commit 043fbef

Please sign in to comment.