@@ -282,6 +282,10 @@ def test_fft(func_name):
282282 'unstack' : lambda : xp .unstack (xp .ones ((3 , 3 )), axis = 0 ),
283283}
284284
285+ api_version_2024_12_examples = {
286+ 'diff' : lambda : xp .diff (xp .asarray ([0 , 1 , 2 ])),
287+ }
288+
285289@pytest .mark .parametrize ('func_name' , api_version_2023_12_examples .keys ())
286290def test_api_version_2023_12 (func_name ):
287291 func = api_version_2023_12_examples [func_name ]
@@ -300,6 +304,28 @@ def test_api_version_2023_12(func_name):
300304 set_array_api_strict_flags (api_version = '2022.12' )
301305 pytest .raises (RuntimeError , func )
302306
307+ @pytest .mark .parametrize ('func_name' , api_version_2024_12_examples .keys ())
308+ def test_api_version_2024_12 (func_name ):
309+ func = api_version_2024_12_examples [func_name ]
310+
311+ # By default, these functions should error
312+ pytest .raises (RuntimeError , func )
313+
314+ # In 2022.12 and 2023.12, these functions should error
315+ set_array_api_strict_flags (api_version = '2022.12' )
316+ pytest .raises (RuntimeError , func )
317+ set_array_api_strict_flags (api_version = '2023.12' )
318+ pytest .raises (RuntimeError , func )
319+
320+ # They should not error in 2024.12
321+ with pytest .warns (UserWarning ):
322+ set_array_api_strict_flags (api_version = '2024.12' )
323+ func ()
324+
325+ # Test the behavior gets updated properly
326+ set_array_api_strict_flags (api_version = '2023.12' )
327+ pytest .raises (RuntimeError , func )
328+
303329def test_disabled_extensions ():
304330 # Test that xp.extension errors when an extension is disabled, and that
305331 # xp.__all__ is updated properly.
0 commit comments