Skip to content

Commit 9df9aa8

Browse files
lithomas1ivirshup
andcommitted
add regression test for asarray
Co-Authored-By: Isaac Virshup <[email protected]>
1 parent ec4f628 commit 9df9aa8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_common.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,16 @@ def test_to_device_host(library):
6060
# here is that we can test portably after calling
6161
# to_device(x, "cpu") to return to host
6262
assert_allclose(x, expected)
63+
64+
65+
@pytest.mark.parametrize("target_library,func", is_functions.items())
66+
@pytest.mark.parametrize("source_library", is_functions.keys())
67+
def test_asarray(source_library, target_library, func):
68+
src_lib = import_(source_library, wrapper=True)
69+
tgt_lib = import_(target_library, wrapper=True)
70+
is_tgt_type = globals()[func]
71+
72+
a = src_lib.asarray([1, 2, 3])
73+
b = tgt_lib.asarray(a)
74+
75+
assert is_tgt_type(b), f"Expected {b} to be a {tgt_lib.ndarray}, but was {type(b)}"

0 commit comments

Comments
 (0)