Skip to content

Commit f251900

Browse files

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ def check(
8787
and get_origin(shape_type) is tuple
8888
and (tuple_args := get_args(shape_type))
8989
and ... not in tuple_args # fixed-length tuple
90-
and (arr_ndim := actual.ndim) != (expected_ndim := len(tuple_args)) # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue]
90+
and (arr_ndim := getattr(actual, "ndim")) # noqa: B009
91+
!= (expected_ndim := len(tuple_args))
9192
):
9293
raise RuntimeError(
9394
f"Array has wrong dimension {arr_ndim}, expected {expected_ndim}"
@@ -99,7 +100,7 @@ def check(
99100
and (dtype_args := get_args(dtype_type))
100101
and isinstance((expected_dtype := dtype_args[0]), type)
101102
and issubclass(expected_dtype, np.generic)
102-
and (arr_dtype := actual.dtype) != expected_dtype # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue]
103+
and (arr_dtype := getattr(actual, "dtype")) != expected_dtype # noqa: B009
103104
):
104105
raise RuntimeError(
105106
f"Array has wrong dtype {arr_dtype}, expected {expected_dtype.__name__}"

0 commit comments

Comments
 (0)