Skip to content

Commit 755a285

Browse files
committed
ENH: set the default version to 2024.12
And adapt test_flags accordingly.
1 parent 5ccb0e7 commit 755a285

File tree

2 files changed

+30
-20
lines changed

2 files changed

+30
-20
lines changed

array_api_strict/_flags.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222
"2021.12",
2323
"2022.12",
2424
"2023.12",
25+
"2024.12"
2526
)
2627

27-
draft_version = "2024.12"
28+
draft_version = "2025.12"
2829

29-
API_VERSION = default_version = "2023.12"
30+
API_VERSION = default_version = "2024.12"
3031

3132
BOOLEAN_INDEXING = True
3233

array_api_strict/tests/test_flags.py

+27-18
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
def test_flag_defaults():
2020
flags = get_array_api_strict_flags()
2121
assert flags == {
22-
'api_version': '2023.12',
22+
'api_version': '2024.12',
2323
'boolean_indexing': True,
2424
'data_dependent_shapes': True,
2525
'enabled_extensions': ('linalg', 'fft'),
@@ -36,7 +36,7 @@ def test_reset_flags():
3636
reset_array_api_strict_flags()
3737
flags = get_array_api_strict_flags()
3838
assert flags == {
39-
'api_version': '2023.12',
39+
'api_version': '2024.12',
4040
'boolean_indexing': True,
4141
'data_dependent_shapes': True,
4242
'enabled_extensions': ('linalg', 'fft'),
@@ -47,15 +47,15 @@ def test_setting_flags():
4747
set_array_api_strict_flags(data_dependent_shapes=False)
4848
flags = get_array_api_strict_flags()
4949
assert flags == {
50-
'api_version': '2023.12',
50+
'api_version': '2024.12',
5151
'boolean_indexing': True,
5252
'data_dependent_shapes': False,
5353
'enabled_extensions': ('linalg', 'fft'),
5454
}
5555
set_array_api_strict_flags(enabled_extensions=('fft',))
5656
flags = get_array_api_strict_flags()
5757
assert flags == {
58-
'api_version': '2023.12',
58+
'api_version': '2024.12',
5959
'boolean_indexing': True,
6060
'data_dependent_shapes': False,
6161
'enabled_extensions': ('fft',),
@@ -98,15 +98,26 @@ def test_flags_api_version_2023_12():
9898
}
9999

100100
def test_flags_api_version_2024_12():
101-
# Make sure setting the version to 2024.12 issues a warning.
101+
set_array_api_strict_flags(api_version='2024.12')
102+
flags = get_array_api_strict_flags()
103+
assert flags == {
104+
'api_version': '2024.12',
105+
'boolean_indexing': True,
106+
'data_dependent_shapes': True,
107+
'enabled_extensions': ('linalg', 'fft'),
108+
}
109+
110+
111+
def test_flags_api_version_2025_12():
112+
# Make sure setting the version to 2025.12 issues a warning.
102113
with pytest.warns(UserWarning) as record:
103-
set_array_api_strict_flags(api_version='2024.12')
114+
set_array_api_strict_flags(api_version='2025.12')
104115
assert len(record) == 1
105-
assert '2024.12' in str(record[0].message)
116+
assert '2025.12' in str(record[0].message)
106117
assert 'draft' in str(record[0].message)
107118
flags = get_array_api_strict_flags()
108119
assert flags == {
109-
'api_version': '2024.12',
120+
'api_version': '2025.12',
110121
'boolean_indexing': True,
111122
'data_dependent_shapes': True,
112123
'enabled_extensions': ('linalg', 'fft'),
@@ -125,9 +136,12 @@ def test_setting_flags_invalid():
125136

126137
def test_api_version():
127138
# Test defaults
128-
assert xp.__array_api_version__ == '2023.12'
139+
assert xp.__array_api_version__ == '2024.12'
129140

130141
# Test setting the version
142+
set_array_api_strict_flags(api_version='2023.12')
143+
assert xp.__array_api_version__ == '2023.12'
144+
131145
set_array_api_strict_flags(api_version='2022.12')
132146
assert xp.__array_api_version__ == '2022.12'
133147

@@ -315,20 +329,15 @@ def test_api_version_2023_12(func_name):
315329
def test_api_version_2024_12(func_name):
316330
func = api_version_2024_12_examples[func_name]
317331

318-
# By default, these functions should error
319-
pytest.raises(RuntimeError, func)
332+
# By default, these functions should not error
333+
func()
320334

321335
# In 2022.12 and 2023.12, these functions should error
322336
set_array_api_strict_flags(api_version='2022.12')
323337
pytest.raises(RuntimeError, func)
324338
set_array_api_strict_flags(api_version='2023.12')
325339
pytest.raises(RuntimeError, func)
326340

327-
# They should not error in 2024.12
328-
with pytest.warns(UserWarning):
329-
set_array_api_strict_flags(api_version='2024.12')
330-
func()
331-
332341
# Test the behavior gets updated properly
333342
set_array_api_strict_flags(api_version='2023.12')
334343
pytest.raises(RuntimeError, func)
@@ -435,9 +444,9 @@ def test_environment_variables():
435444
# ARRAY_API_STRICT_API_VERSION
436445
('''\
437446
import array_api_strict as xp
438-
assert xp.__array_api_version__ == '2023.12'
447+
assert xp.__array_api_version__ == '2024.12'
439448
440-
assert xp.get_array_api_strict_flags()['api_version'] == '2023.12'
449+
assert xp.get_array_api_strict_flags()['api_version'] == '2024.12'
441450
442451
''', {}),
443452
*[

0 commit comments

Comments
 (0)