@@ -34,13 +34,13 @@ def test_report_timing(self):
34
34
m = ConcreteModel ()
35
35
m .x = Var ([1 ,2 ])
36
36
37
- ref = """
38
- 0 seconds to construct Block ConcreteModel; 1 index total
39
- 0 seconds to construct RangeSet FiniteSimpleRangeSet; 1 index total
40
- 0 seconds to construct Var x; 2 indicies total
41
- 0 seconds to construct Suffix Suffix; 1 index total
42
- 0 seconds to apply Transformation RelaxIntegerVars (in-place)
43
- """ .strip ()
37
+ ref = r """
38
+ (0(\.\d+)?) seconds to construct Block ConcreteModel; 1 index total
39
+ (0(\.\d+)?) seconds to construct RangeSet FiniteSimpleRangeSet; 1 index total
40
+ (0(\.\d+)?) seconds to construct Var x; 2 indices total
41
+ (0(\.\d+)?) seconds to construct Suffix Suffix; 1 index total
42
+ (0(\.\d+)?) seconds to apply Transformation RelaxIntegerVars \ (in-place\ )
43
+ """ .strip ()
44
44
45
45
xfrm = TransformationFactory ('core.relax_integer_vars' )
46
46
@@ -51,7 +51,10 @@ def test_report_timing(self):
51
51
m .r = RangeSet (2 )
52
52
m .x = Var (m .r )
53
53
xfrm .apply_to (m )
54
- self .assertEqual (out .getvalue ().strip (), ref )
54
+ result = out .getvalue ().strip ()
55
+ self .maxDiff = None
56
+ for l , r in zip (result .splitlines (), ref .splitlines ()):
57
+ self .assertRegex (str (l .strip ()), str (r .strip ()))
55
58
finally :
56
59
report_timing (False )
57
60
@@ -62,7 +65,10 @@ def test_report_timing(self):
62
65
m .r = RangeSet (2 )
63
66
m .x = Var (m .r )
64
67
xfrm .apply_to (m )
65
- self .assertEqual (os .getvalue ().strip (), ref )
68
+ result = os .getvalue ().strip ()
69
+ self .maxDiff = None
70
+ for l , r in zip (result .splitlines (), ref .splitlines ()):
71
+ self .assertRegex (str (l .strip ()), str (r .strip ()))
66
72
finally :
67
73
report_timing (False )
68
74
buf = StringIO ()
@@ -71,7 +77,10 @@ def test_report_timing(self):
71
77
m .r = RangeSet (2 )
72
78
m .x = Var (m .r )
73
79
xfrm .apply_to (m )
74
- self .assertEqual (os .getvalue ().strip (), ref )
80
+ result = os .getvalue ().strip ()
81
+ self .maxDiff = None
82
+ for l , r in zip (result .splitlines (), ref .splitlines ()):
83
+ self .assertRegex (str (l .strip ()), str (r .strip ()))
75
84
self .assertEqual (buf .getvalue ().strip (), "" )
76
85
77
86
def test_TicTocTimer_tictoc (self ):
@@ -131,7 +140,7 @@ def test_TicTocTimer_tictoc(self):
131
140
132
141
# Note: pypy on GHA frequently has timing differences of >0.02s
133
142
# for the following tests
134
- RES = 4e -2
143
+ RES = 5e -2
135
144
136
145
with capture_output () as out :
137
146
delta = timer .toc ()
0 commit comments