Skip to content

Commit 97b67a8

Browse files
committed
typing
1 parent 8119b38 commit 97b67a8

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/array_api_extra/_lib/_testing.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,14 @@ def _check_ns_shape_dtype(
7676
desired_shape = cast(tuple[float, ...], desired.shape)
7777
assert None not in actual_shape # Requires explicit support
7878
assert None not in desired_shape
79+
7980
if is_dask_namespace(desired_xp):
8081
if any(math.isnan(i) for i in actual_shape):
8182
actual.compute_chunk_sizes() # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue]
82-
actual_shape = actual.shape
83+
actual_shape = cast(tuple[float, ...], actual.shape)
8384
if any(math.isnan(i) for i in desired_shape):
8485
desired.compute_chunk_sizes() # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue]
85-
desired_shape = desired.shape
86+
desired_shape = cast(tuple[float, ...], desired.shape)
8687

8788
if check_shape:
8889
msg = f"shapes do not match: {actual_shape} != f{desired_shape}"
@@ -92,8 +93,8 @@ def _check_ns_shape_dtype(
9293
# np.testing.assert_array_equal etc even when strict=False, but not for
9394
# non-materializable arrays.
9495
# This check excludes 0d arrays as they are special-cased in NumPy.
95-
actual_size = math.prod(actual_shape) # pyright: ignore[reportUnknownArgumentType]
96-
desired_size = math.prod(desired_shape) # pyright: ignore[reportUnknownArgumentType]
96+
actual_size = math.prod(actual_shape)
97+
desired_size = math.prod(desired_shape)
9798
msg = f"sizes do not match: {actual_size} != f{desired_size}"
9899
assert actual_size == desired_size, msg
99100

0 commit comments

Comments
 (0)