Skip to content

Commit e7bfad9

Browse files
committed
fix tests
1 parent a7791e1 commit e7bfad9

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

pyomo/contrib/pynumero/algorithms/solvers/tests/test_cyipopt_interfaces.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ def test_model1_CyIpoptNLP_scaling(self):
156156

157157
cynlp = CyIpoptNLP(PyomoNLP(m))
158158
obj_scaling, x_scaling, g_scaling = cynlp.scaling_factors()
159-
self.assertTrue(obj_scaling is None)
160-
self.assertTrue(x_scaling is None)
161-
self.assertTrue(g_scaling is None)
159+
self.assertTrue(obj_scaling == 1.0)
160+
self.assertTrue((x_scaling == 1.0).all())
161+
self.assertTrue((g_scaling == 1.0).all())
162162

163163
def _check_model1(self, nlp, cynlp):
164164
# test x_init

pyomo/contrib/pynumero/interfaces/tests/test_external_grey_box_model.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1827,7 +1827,7 @@ def create_model_two_equalities_two_outputs(self, external_model):
18271827
m.egb.outputs['Pout'].setub(70)
18281828
return m
18291829

1830-
def test_scaling_all_missing(self):
1830+
def test_scaling_all_one(self):
18311831
m = self.create_model_two_equalities_two_outputs(
18321832
ex_models.PressureDropTwoEqualitiesTwoOutputs()
18331833
)
@@ -1836,9 +1836,9 @@ def test_scaling_all_missing(self):
18361836
fs = pyomo_nlp.get_obj_scaling()
18371837
xs = pyomo_nlp.get_primals_scaling()
18381838
cs = pyomo_nlp.get_constraints_scaling()
1839-
self.assertIsNone(fs)
1840-
self.assertIsNone(xs)
1841-
self.assertIsNone(cs)
1839+
self.assertEqual(fs, 1.0)
1840+
self.assertTrue((xs == 1.0).all())
1841+
self.assertTrue((cs == 1.0).all())
18421842

18431843
def test_scaling_pyomo_model_only(self):
18441844
m = self.create_model_two_equalities_two_outputs(

pyomo/contrib/pynumero/interfaces/tests/test_pyomo_grey_box_nlp.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2248,7 +2248,7 @@ def create_model_two_equalities_two_outputs(self, external_model):
22482248
m.egb.outputs['Pout'].setub(70)
22492249
return m
22502250

2251-
def test_scaling_all_missing(self):
2251+
def test_scaling_all_one(self):
22522252
m = self.create_model_two_equalities_two_outputs(
22532253
ex_models.PressureDropTwoEqualitiesTwoOutputs()
22542254
)
@@ -2257,9 +2257,9 @@ def test_scaling_all_missing(self):
22572257
fs = pyomo_nlp.get_obj_scaling()
22582258
xs = pyomo_nlp.get_primals_scaling()
22592259
cs = pyomo_nlp.get_constraints_scaling()
2260-
self.assertIsNone(fs)
2261-
self.assertIsNone(xs)
2262-
self.assertIsNone(cs)
2260+
self.assertEqual(fs, 1.0)
2261+
self.assertTrue((xs == 1.0).all())
2262+
self.assertTrue((cs == 1.0).all())
22632263

22642264
def test_scaling_pyomo_model_only(self):
22652265
m = self.create_model_two_equalities_two_outputs(

0 commit comments

Comments
 (0)