Skip to content

Commit

Permalink
Closes #3450 deprecate operator_tests.py (#3618)
Browse files Browse the repository at this point in the history
Co-authored-by: Amanda Potts <ajpotts@users.noreply.github.com>
  • Loading branch information
ajpotts and ajpotts authored Aug 5, 2024
1 parent e727765 commit 6a3d2a4
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
48 changes: 48 additions & 0 deletions PROTO_tests/tests/operator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,54 @@ def test_shift_bool_int64_binop(self):
assert np.allclose((ak_bool[0] >> ak_int).to_ndarray(), np_bool[0] >> np_int)
assert np.allclose((ak_bool[0] << ak_int).to_ndarray(), np_bool[0] << np_int)

def test_shift_equals_scalar_binops(self):
vector_pairs = [
(ak.arange(0, 5, dtype=ak.int64), np.arange(5, dtype=np.int64)),
(ak.arange(0, 5, dtype=ak.uint64), np.arange(5, dtype=np.uint64)),
]
shift_scalars = [np.int64(1), np.int64(5), np.uint64(1), np.uint64(5), True, False]

for ak_vector, np_vector in vector_pairs:
for x in shift_scalars:
assert ak_vector.to_list() == np_vector.tolist()

ak_vector <<= x
np_vector <<= x
assert ak_vector.to_list() == np_vector.tolist()

ak_vector >>= x
np_vector >>= x
assert ak_vector.to_list() == np_vector.tolist()

def test_shift_equals_vector_binops(self):
vector_pairs = [
(ak.arange(0, 5, dtype=ak.int64), np.arange(5, dtype=np.int64)),
(ak.arange(0, 5, dtype=ak.uint64), np.arange(5, dtype=np.uint64)),
]
shift_vectors = [
ak.ones(5, dtype=ak.int64),
ak.zeros(5, dtype=ak.int64),
ak.ones(5, dtype=ak.uint64),
ak.zeros(5, dtype=ak.uint64),
ak.array([1, 0, 1, 0, 1], dtype=bool),
ak.array([1, 1, 1, 1, 1], dtype=bool),
]

for ak_vector, np_vector in vector_pairs:
for v in shift_vectors:
if (v[0].dtype.kind != "b") and (ak_vector[0].dtype.kind != v[0].dtype.kind):
continue

assert ak_vector.to_list() == np_vector.tolist()

ak_vector <<= v
np_vector <<= v.to_ndarray()
assert ak_vector.to_list() == np_vector.tolist()

ak_vector >>= v
np_vector >>= v.to_ndarray()
assert ak_vector.to_list() == np_vector.tolist()

def test_concatenate_type_preservation(self):
# Test that concatenate preserves special pdarray types (IPv4, Datetime, BitVector, ...)
from arkouda.util import generic_concat as akuconcat
Expand Down
1 change: 0 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ filterwarnings =
ignore:Version mismatch between client .*
testpaths =
tests/coargsort_test.py
tests/operator_tests.py
tests/pdarray_creation_test.py
tests/sort_test.py
tests/symbol_table_test.py
Expand Down
File renamed without changes.

0 comments on commit 6a3d2a4

Please sign in to comment.