Skip to content

Commit

Permalink
Closes Bears-R-Us#3912: failing unit test test_is_locally_sorted_mult…
Browse files Browse the repository at this point in the history
…idim under gasnet nl==2
  • Loading branch information
ajpotts committed Nov 21, 2024
1 parent 15bd176 commit cf1ed34
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions tests/pdarrayclass_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,40 @@
class TestPdarrayClass:

@pytest.mark.skip_if_max_rank_less_than(2)
def test_reshape(self):
a = ak.arange(4)
@pytest.mark.parametrize("dtype", DTYPES)
def test_reshape(self, dtype):
a = ak.arange(4, dtype=dtype)
r = a.reshape((2, 2))
assert r.shape == (2, 2)
assert isinstance(r, ak.pdarray)

def test_shape(self):
a = ak.arange(4)
np_a = np.arange(4)
@pytest.mark.parametrize("dtype", list(set(DTYPES) - set(["bool"])))
def test_shape(self, dtype):
a = ak.arange(4, dtype=dtype)
np_a = np.arange(4, dtype=dtype)
assert isinstance(a.shape, tuple)
assert a.shape == np_a.shape

@pytest.mark.skip_if_max_rank_less_than(2)
def test_shape_multidim(self):
a = ak.arange(4).reshape((2, 2))
np_a = np.arange(4).reshape((2, 2))
@pytest.mark.parametrize("dtype", list(set(DTYPES) - set(["bool"])))
def test_shape_multidim(self, dtype):
a = ak.arange(4, dtype=dtype).reshape((2, 2))
np_a = np.arange(4, dtype=dtype).reshape((2, 2))
assert isinstance(a.shape, tuple)
assert a.shape == np_a.shape

@pytest.mark.parametrize("size", pytest.prob_size)
def test_flatten(self, size):
a = ak.arange(size)
@pytest.mark.parametrize("dtype", DTYPES)
def test_flatten(self, size, dtype):
a = ak.arange(size, dtype=dtype)
ak_assert_equal(a.flatten(), a)

@pytest.mark.skip_if_max_rank_less_than(3)
@pytest.mark.parametrize("dtype", DTYPES)
@pytest.mark.parametrize("size", pytest.prob_size)
def test_flatten(self, size):
def test_flatten_multidim(self, size, dtype):
size = size - (size % 4)
a = ak.arange(size)
a = ak.arange(size, dtype=dtype)
b = a.reshape((2, 2, size / 4))
ak_assert_equal(b.flatten(), a)

Expand Down Expand Up @@ -114,12 +119,13 @@ def test_is_locally_sorted_multi_locale(self, size):
assert not is_sorted(a)

@pytest.mark.skip_if_max_rank_less_than(3)
@pytest.mark.skip_if_nl_greater_than(2)
@pytest.mark.parametrize("dtype", DTYPES)
@pytest.mark.parametrize("axis", [None, 0, 1, (0, 2), (0, 1, 2)])
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))
a = ak.array(ak.randint(0, 100, (10, 10, 10), dtype=ak.int64, seed=SEED))
sorted = is_locally_sorted(a, axis=axis)
if isinstance(sorted, np.bool_):
assert not sorted
Expand Down

0 comments on commit cf1ed34

Please sign in to comment.