16
16
from control .lti import evalfr
17
17
from control .exception import slycot_check
18
18
19
+ from .conftest import editsdefaults
19
20
20
21
class TestStateSpace (unittest .TestCase ):
21
22
"""Tests for the StateSpace class."""
@@ -716,7 +717,7 @@ def test_sample_system_prewarping(self):
716
717
(LTX_G2 , LTX_G2_REF )])
717
718
@pytest .mark .parametrize ("repr_type" , [None , "partitioned" , "separate" ])
718
719
@pytest .mark .parametrize ("num_format" , [None , ".3g" , ".5g" ])
719
- def test_latex_repr (g , ref , repr_type , num_format ):
720
+ def test_latex_repr (g , ref , repr_type , num_format , editsdefaults ):
720
721
"""Test `._latex_repr_` with different config values
721
722
722
723
This is a 'gold image' test, so if you change behaviour,
@@ -725,21 +726,15 @@ def test_latex_repr(g, ref, repr_type, num_format):
725
726
control.reset_defaults()
726
727
print(f'p3_p : {g1._repr_latex_()!r}')
727
728
"""
728
- from control import set_defaults , reset_defaults
729
- try :
730
- # add "editsdefaults" fixture and remove the reset_defaults as soon as
731
- # gh-438 is merged
732
- reset_defaults ()
733
- if num_format is not None :
734
- set_defaults ('statesp' , latex_num_format = num_format )
735
-
736
- if repr_type is not None :
737
- set_defaults ('statesp' , latex_repr_type = repr_type )
738
-
739
- refkey = "{}_{}" .format (refkey_n [num_format ], refkey_r [repr_type ])
740
- assert g ._repr_latex_ () == ref [refkey ]
741
- finally :
742
- reset_defaults ()
729
+ from control import set_defaults
730
+ if num_format is not None :
731
+ set_defaults ('statesp' , latex_num_format = num_format )
732
+
733
+ if repr_type is not None :
734
+ set_defaults ('statesp' , latex_repr_type = repr_type )
735
+
736
+ refkey = "{}_{}" .format (refkey_n [num_format ], refkey_r [repr_type ])
737
+ assert g ._repr_latex_ () == ref [refkey ]
743
738
744
739
745
740
if __name__ == "__main__" :
0 commit comments