Skip to content

Commit 7b03174

Browse files
committed
update test skip condition
1 parent 5dc9da2 commit 7b03174

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

arraycontext/container/traversal.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,7 @@ def _unflatten(template_subary: ArrayOrContainerT) -> ArrayOrContainerT:
590590
"array context.") from exc
591591

592592
if hasattr(template_subary, "strides"):
593-
if template_subary.size != 0 \
594-
and template_subary.strides != subary.strides:
593+
if template_subary.strides != subary.strides:
595594
raise ValueError(
596595
f"strides do not match template: got {subary.strides}, "
597596
f"expected {template_subary.strides}")

test/test_arraycontext.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -900,9 +900,11 @@ def test_container_norm(actx_factory, ord):
900900
[(64, 7), (154, 12)]
901901
])
902902
def test_flatten_array_container(actx_factory, shapes):
903+
if np.prod(shapes) == 0:
904+
# https://github.com/inducer/compyte/pull/36
905+
pytest.xfail("strides do not match in subary")
906+
903907
actx = actx_factory()
904-
if np.prod(shapes) == 0 and isinstance(actx, PytatoPyOpenCLArrayContext):
905-
pytest.skip("operation not supported on PytatoPyOpenCLArrayContext")
906908

907909
from arraycontext import flatten, unflatten
908910
arys = _get_test_containers(actx, shapes=shapes)
@@ -912,16 +914,17 @@ def test_flatten_array_container(actx_factory, shapes):
912914
assert flat.ndim == 1
913915

914916
ary_roundtrip = unflatten(ary, flat, actx)
915-
assert actx.to_numpy(
916-
actx.np.linalg.norm(ary - ary_roundtrip)
917-
) < 1.0e-15
918917

919918
from arraycontext import rec_multimap_reduce_array_container
920919
assert rec_multimap_reduce_array_container(
921920
np.prod,
922921
lambda x, y: x.shape == y.shape,
923922
ary, ary_roundtrip)
924923

924+
assert actx.to_numpy(
925+
actx.np.linalg.norm(ary - ary_roundtrip)
926+
) < 1.0e-15
927+
925928

926929
def test_flatten_array_container_failure(actx_factory):
927930
actx = actx_factory()

0 commit comments

Comments
 (0)