Skip to content

Commit

Permalink
debug tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpotts committed Oct 31, 2024
1 parent 9f745ef commit bc01454
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions tests/pdarrayclass_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,23 @@ def test_is_sorted(self, size, dtype, axis):
assert not ak.is_sorted(c, axis=axis)

@pytest.mark.skip_if_max_rank_less_than(3)
@pytest.mark.parametrize("dtype", DTYPES)
@pytest.mark.parametrize("dtype", list(set(DTYPES) - set(["bool"])))
@pytest.mark.parametrize("axis", [None, 0, 1, (0, 2), (0, 1, 2)])
def test_is_sorted_multidim(self, dtype, axis):

a = ak.array(ak.randint(0, 100, (5, 7, 4), dtype=dtype, seed=SEED))
assert ak.all(ak.is_sorted(a, axis=axis) == False)

x = ak.arange(10).reshape((2, 5))
assert ak.all(ak.is_sorted(x, axis=axis))
sorted = ak.is_sorted(a, axis=axis)
if isinstance(sorted, np.bool_):
assert not sorted
else:
assert ak.all(sorted == False)

x = ak.arange(40).reshape((2, 10, 2))
sorted = ak.is_sorted(x, axis=axis)
if isinstance(sorted, np.bool_):
assert sorted
else:
assert ak.all(sorted)

@pytest.mark.parametrize("size", pytest.prob_size)
@pytest.mark.parametrize("dtype", DTYPES)
Expand Down Expand Up @@ -109,10 +117,18 @@ def test_is_locally_sorted_multidim(self, dtype, axis):
from arkouda.pdarrayclass import is_locally_sorted

a = ak.array(ak.randint(0, 100, (5, 7, 4), dtype=ak.int64, seed=SEED))
assert ak.all(is_locally_sorted(a, axis=axis) == False)

x = ak.arange(10).reshape((2, 5))
assert ak.all(is_locally_sorted(x, axis=axis))
sorted = is_locally_sorted(a, axis=axis)
if isinstance(sorted, np.bool_):
assert not sorted
else:
assert ak.all(sorted == False)

x = ak.arange(40).reshape((2, 10, 2))
sorted = is_locally_sorted(x, axis=axis)
if isinstance(sorted, np.bool_):
assert sorted
else:
assert ak.all(sorted)

def assert_reduction_ops_match(
self, op: str, pda: ak.pdarray, axis: Optional[Union[int, Tuple[int, ...]]] = None
Expand Down

0 comments on commit bc01454

Please sign in to comment.