Skip to content

Commit 20a6360

Browse files
Update positive_int_or_minus_1 tests
1 parent 3797608 commit 20a6360

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

pyomo/contrib/pyros/tests/test_config.py

+18-11
Original file line numberDiff line numberDiff line change
@@ -558,21 +558,28 @@ def test_positive_int_or_minus_one(self):
558558
Test positive int or -1 validator works as expected.
559559
"""
560560
standardizer_func = positive_int_or_minus_one
561-
self.assertIs(
562-
standardizer_func(1.0),
561+
ans = standardizer_func(1.0)
562+
self.assertEqual(
563+
ans,
563564
1,
564-
msg=(
565-
f"{positive_int_or_minus_one.__name__} "
566-
"does not standardize as expected."
567-
),
565+
msg=f"{positive_int_or_minus_one.__name__} output value not as expected.",
566+
)
567+
self.assertIs(
568+
type(ans),
569+
int,
570+
msg=f"{positive_int_or_minus_one.__name__} output type not as expected.",
568571
)
572+
573+
ans = standardizer_func(-1.0)
569574
self.assertEqual(
570-
standardizer_func(-1.00),
575+
ans,
571576
-1,
572-
msg=(
573-
f"{positive_int_or_minus_one.__name__} "
574-
"does not standardize as expected."
575-
),
577+
msg=f"{positive_int_or_minus_one.__name__} output value not as expected.",
578+
)
579+
self.assertIs(
580+
type(ans),
581+
int,
582+
msg=f"{positive_int_or_minus_one.__name__} output type not as expected.",
576583
)
577584

578585
exc_str = r"Expected positive int or -1, but received value.*"

0 commit comments

Comments
 (0)