11import numba
22import numpy as np
33
4- from stumpy import fastmath
4+ from stumpy import cache , fastmath
55
66
77def test_set ():
@@ -11,11 +11,13 @@ def test_set():
1111
1212 # case1: flag=False
1313 fastmath ._set ("fastmath" , "_add_assoc" , flag = False )
14+ cache ._recompile ()
1415 out = fastmath ._add_assoc (0 , np .inf )
1516 assert np .isnan (out )
1617
1718 # case2: flag={'reassoc', 'nsz'}
1819 fastmath ._set ("fastmath" , "_add_assoc" , flag = {"reassoc" , "nsz" })
20+ cache ._recompile ()
1921 out = fastmath ._add_assoc (0 , np .inf )
2022 if numba .config .DISABLE_JIT :
2123 assert np .isnan (out )
@@ -24,11 +26,13 @@ def test_set():
2426
2527 # case3: flag={'reassoc'}
2628 fastmath ._set ("fastmath" , "_add_assoc" , flag = {"reassoc" })
29+ cache ._recompile ()
2730 out = fastmath ._add_assoc (0 , np .inf )
2831 assert np .isnan (out )
2932
3033 # case4: flag={'nsz'}
3134 fastmath ._set ("fastmath" , "_add_assoc" , flag = {"nsz" })
35+ cache ._recompile ()
3236 out = fastmath ._add_assoc (0 , np .inf )
3337 assert np .isnan (out )
3438
@@ -39,7 +43,9 @@ def test_reset():
3943 # https://numba.pydata.org/numba-doc/dev/user/performance-tips.html#fastmath
4044 # and then reset it to the default value, i.e. `True`
4145 fastmath ._set ("fastmath" , "_add_assoc" , False )
46+ cache ._recompile ()
4247 fastmath ._reset ("fastmath" , "_add_assoc" )
48+ cache ._recompile ()
4349 if numba .config .DISABLE_JIT :
4450 assert np .isnan (fastmath ._add_assoc (0.0 , np .inf ))
4551 else : # pragma: no cover
0 commit comments