Skip to content

Commit 2ca47e1

Browse files
committed
Fix improper way of setting defaults in test
1 parent 8d7ac56 commit 2ca47e1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

control/tests/xferfcn_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
import control as ct
1111
from control import StateSpace, TransferFunction, rss, evalfr
1212
from control import ss, ss2tf, tf, tf2ss, zpk
13-
from control import isctime, isdtime, sample_system, defaults, reset_defaults
13+
from control import isctime, isdtime, sample_system
14+
from control import defaults, reset_defaults, set_defaults
1415
from control.statesp import _convert_to_statespace
1516
from control.xferfcn import _convert_to_transfer_function
1617
from control.tests.conftest import slycotonly, matrixfilter
@@ -990,8 +991,9 @@ def test_printing_zpk(self, zeros, poles, gain, output):
990991
])
991992
def test_printing_zpk_format(self, zeros, poles, gain, format, output):
992993
"""Test _tf_polynomial_to_string for constant systems"""
993-
defaults['xferfcn.floating_point_format'] = format
994994
G = tf([1], [1,2,3], display_format='zpk')
995+
996+
set_defaults('xferfcn', floating_point_format=format)
995997
res = str(G)
996998
reset_defaults()
997999

control/xferfcn.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def _float2str(value):
7878
formatter = "{:" + config.defaults.get('xferfcn.floating_point_format', ':.4g') + "}"
7979
return formatter.format(value)
8080

81+
8182
class TransferFunction(LTI):
8283
"""TransferFunction(num, den[, dt])
8384

0 commit comments

Comments
 (0)