Skip to content

Commit ed48a36

Browse files
committed
Add tests for T and mT in array_api
Original NumPy Commit: 18fe695dbc66df660039aca9f76a949de8b9348e
1 parent c81c679 commit ed48a36

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

array_api_strict/tests/test_array_object.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import numpy as np
55

66
from .. import ones, asarray, result_type, all, equal
7+
from .._array_object import Array
78
from .._dtypes import (
89
_all_dtypes,
910
_boolean_dtypes,
@@ -301,3 +302,16 @@ def test_device_property():
301302

302303
assert all(equal(asarray(a, device='cpu'), a))
303304
assert_raises(ValueError, lambda: asarray(a, device='gpu'))
305+
306+
def test_array_properties():
307+
a = ones((1, 2, 3))
308+
b = ones((2, 3))
309+
assert_raises(ValueError, lambda: a.T)
310+
311+
assert isinstance(b.T, Array)
312+
assert b.T.shape == (3, 2)
313+
314+
assert isinstance(a.mT, Array)
315+
assert a.mT.shape == (1, 3, 2)
316+
assert isinstance(b.mT, Array)
317+
assert b.mT.shape == (3, 2)

0 commit comments

Comments
 (0)