19
19
def test_flag_defaults ():
20
20
flags = get_array_api_strict_flags ()
21
21
assert flags == {
22
- 'api_version' : '2023 .12' ,
22
+ 'api_version' : '2024 .12' ,
23
23
'boolean_indexing' : True ,
24
24
'data_dependent_shapes' : True ,
25
25
'enabled_extensions' : ('linalg' , 'fft' ),
@@ -36,7 +36,7 @@ def test_reset_flags():
36
36
reset_array_api_strict_flags ()
37
37
flags = get_array_api_strict_flags ()
38
38
assert flags == {
39
- 'api_version' : '2023 .12' ,
39
+ 'api_version' : '2024 .12' ,
40
40
'boolean_indexing' : True ,
41
41
'data_dependent_shapes' : True ,
42
42
'enabled_extensions' : ('linalg' , 'fft' ),
@@ -47,15 +47,15 @@ def test_setting_flags():
47
47
set_array_api_strict_flags (data_dependent_shapes = False )
48
48
flags = get_array_api_strict_flags ()
49
49
assert flags == {
50
- 'api_version' : '2023 .12' ,
50
+ 'api_version' : '2024 .12' ,
51
51
'boolean_indexing' : True ,
52
52
'data_dependent_shapes' : False ,
53
53
'enabled_extensions' : ('linalg' , 'fft' ),
54
54
}
55
55
set_array_api_strict_flags (enabled_extensions = ('fft' ,))
56
56
flags = get_array_api_strict_flags ()
57
57
assert flags == {
58
- 'api_version' : '2023 .12' ,
58
+ 'api_version' : '2024 .12' ,
59
59
'boolean_indexing' : True ,
60
60
'data_dependent_shapes' : False ,
61
61
'enabled_extensions' : ('fft' ,),
@@ -98,15 +98,26 @@ def test_flags_api_version_2023_12():
98
98
}
99
99
100
100
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.
102
113
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' )
104
115
assert len (record ) == 1
105
- assert '2024 .12' in str (record [0 ].message )
116
+ assert '2025 .12' in str (record [0 ].message )
106
117
assert 'draft' in str (record [0 ].message )
107
118
flags = get_array_api_strict_flags ()
108
119
assert flags == {
109
- 'api_version' : '2024 .12' ,
120
+ 'api_version' : '2025 .12' ,
110
121
'boolean_indexing' : True ,
111
122
'data_dependent_shapes' : True ,
112
123
'enabled_extensions' : ('linalg' , 'fft' ),
@@ -125,9 +136,12 @@ def test_setting_flags_invalid():
125
136
126
137
def test_api_version ():
127
138
# Test defaults
128
- assert xp .__array_api_version__ == '2023 .12'
139
+ assert xp .__array_api_version__ == '2024 .12'
129
140
130
141
# Test setting the version
142
+ set_array_api_strict_flags (api_version = '2023.12' )
143
+ assert xp .__array_api_version__ == '2023.12'
144
+
131
145
set_array_api_strict_flags (api_version = '2022.12' )
132
146
assert xp .__array_api_version__ == '2022.12'
133
147
@@ -315,20 +329,15 @@ def test_api_version_2023_12(func_name):
315
329
def test_api_version_2024_12 (func_name ):
316
330
func = api_version_2024_12_examples [func_name ]
317
331
318
- # By default, these functions should error
319
- pytest . raises ( RuntimeError , func )
332
+ # By default, these functions should not error
333
+ func ( )
320
334
321
335
# In 2022.12 and 2023.12, these functions should error
322
336
set_array_api_strict_flags (api_version = '2022.12' )
323
337
pytest .raises (RuntimeError , func )
324
338
set_array_api_strict_flags (api_version = '2023.12' )
325
339
pytest .raises (RuntimeError , func )
326
340
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
-
332
341
# Test the behavior gets updated properly
333
342
set_array_api_strict_flags (api_version = '2023.12' )
334
343
pytest .raises (RuntimeError , func )
@@ -435,9 +444,9 @@ def test_environment_variables():
435
444
# ARRAY_API_STRICT_API_VERSION
436
445
('''\
437
446
import array_api_strict as xp
438
- assert xp.__array_api_version__ == '2023 .12'
447
+ assert xp.__array_api_version__ == '2024 .12'
439
448
440
- assert xp.get_array_api_strict_flags()['api_version'] == '2023 .12'
449
+ assert xp.get_array_api_strict_flags()['api_version'] == '2024 .12'
441
450
442
451
''' , {}),
443
452
* [
0 commit comments