Skip to content

Commit 1b3d12e

Browse files
committed
test/custom: test np.norm for custom types
1 parent fd0ed61 commit 1b3d12e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

unittest/python/test_user_type.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ def test(dtype):
4444
mat2 = np.matmul(mat, mat.T)
4545
assert np.isclose(mat2.astype(np.double), mat2_ref).all()
4646

47+
vec = np.ones((rows,), dtype=dtype)
48+
norm = np.norm(vec)
49+
norm_ref = np.norm(vec.astype(np.double))
50+
assert norm == norm_ref
51+
4752

4853
def test_cast(from_dtype, to_dtype):
4954
np.can_cast(from_dtype, to_dtype)

0 commit comments

Comments
 (0)