Skip to content

Commit 876b4a5

Browse files
committed
✨: refactor test files to improve clarity and organization of NDArray definitions
1 parent e4fd64a commit 876b4a5

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

tests/integration/test_numpy1.pyi

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,16 @@ import numpy.array_api as np
55

66
import array_api_typing as xpt
77

8+
# Define an NDArray against which we can test the protocols
9+
arr = np.eye(2)
10+
811
###
912
# Ensure that `np.ndarray` instances are assignable to `xpt.HasArrayNamespace`.
1013

11-
arr = np.eye(2)
1214
arr_namespace: xpt.HasArrayNamespace[Any] = arr
15+
16+
###
17+
# Ensure that `np.ndarray` instances are assignable to `xpt.Array`.
18+
19+
arr_array: xpt.Array[Any, Any] = arr
20+
arr_floatarray: xpt.Array[float, Any] = arr

tests/integration/test_numpy2.pyi

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@ import numpy.typing as npt
44

55
import array_api_typing as xpt
66

7+
# Define an NDArray against which we can test the protocols
8+
arr: npt.NDArray[Any]
9+
710
###
811
# Ensure that `np.ndarray` instances are assignable to `xpt.HasArrayNamespace`.
912

10-
arr: npt.NDArray[Any]
1113
arr_namespace: xpt.HasArrayNamespace[Any] = arr
14+
15+
###
16+
# Ensure that `np.ndarray` instances are assignable to `xpt.Array`.
17+
18+
arr_array: xpt.Array[Any, Any] = arr
19+
arr_floatarray: xpt.Array[float, Any] = arr
20+
arr_boolarray: xpt.Array[bool, Any] = arr

0 commit comments

Comments
 (0)