Skip to content

Commit f809249

Browse files
authored
Merge pull request #406 from ev-br/tuples_not_lists
ENH: Test return values which changes from lists to tuples in 2025.12
2 parents 1707f38 + feed92d commit f809249

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

array_api_tests/test_creation_functions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from . import shape_helpers as sh
1414
from . import xps
1515
from .typing import DataType, Scalar
16+
from . import api_version
1617

1718

1819
class frange(NamedTuple):
@@ -569,6 +570,8 @@ def test_meshgrid(dtype, kw, data):
569570
repro_snippet = ph.format_snippet(f"xp.meshgrid(*arrays, **kw) with {arrays = } and {kw = }")
570571
try:
571572
out = xp.meshgrid(*arrays, **kw)
573+
574+
assert type(out) == (list if api_version < "2025.12" else tuple)
572575
for i, x in enumerate(out):
573576
ph.assert_dtype("meshgrid", in_dtype=dtype, out_dtype=x.dtype, repr_name=f"out[{i}].dtype")
574577
ph.assert_shape("meshgrid", out_shape=x.shape, expected=tgt_shape)

array_api_tests/test_data_type_functions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from . import shape_helpers as sh
1313
from . import xps
1414
from .typing import DataType
15-
15+
from . import api_version
1616

1717
# TODO: test with complex dtypes
1818
def non_complex_dtypes():
@@ -107,6 +107,8 @@ def test_broadcast_arrays(shapes, data):
107107
try:
108108
out = xp.broadcast_arrays(*arrays)
109109

110+
assert type(out) == (list if api_version < "2025.12" else tuple)
111+
110112
expected_shape = sh.broadcast_shapes(*shapes)
111113
for i, x in enumerate(arrays):
112114
ph.assert_dtype(

array_api_tests/test_inspection_functions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from array_api_tests.dtype_helpers import available_kinds, dtype_names
44

55
from . import xp
6+
from . import api_version
67

78
pytestmark = pytest.mark.min_version("2023.12")
89

@@ -31,7 +32,7 @@ def test_devices(self):
3132
assert hasattr(out, "devices")
3233
assert hasattr(out, "default_device")
3334

34-
assert isinstance(out.devices(), list)
35+
assert isinstance(out.devices(), list if api_version < "2025.12" else tuple)
3536
if out.default_device() is not None:
3637
# Per https://github.com/data-apis/array-api/issues/923
3738
# default_device() can return None. Otherwise, it must be a valid device.

0 commit comments

Comments
 (0)