Skip to content

Commit

Permalink
Track changes in repr(FlagType)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiirola committed Oct 4, 2024
1 parent cffc600 commit a08fa45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pyomo/common/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ def __repr__(self):
),
)
self.assertRegex(
c.get("val3").domain_name(), r"IsInstance\(int, .*\.TestClass\)"
c.get("val3").domain_name(), r"IsInstance\[int, TestClass\]"
)
c.val3 = 2
self.assertEqual(c.val3, 2)
Expand All @@ -499,7 +499,7 @@ def __repr__(self):
None, IsInstance(int, TestClass, document_full_base_names=False)
),
)
self.assertEqual(c.get("val4").domain_name(), "IsInstance(int, TestClass)")
self.assertEqual(c.get("val4").domain_name(), "IsInstance[int, TestClass]")
c.val4 = 2
self.assertEqual(c.val4, 2)
exc_str = (
Expand Down
9 changes: 4 additions & 5 deletions pyomo/common/tests/test_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,19 @@
class TestModeling(unittest.TestCase):

def test_NOTSET(self):
self.assertTrue(in_testing_environment())
self.assertFalse(building_documentation())

self.assertEqual(str(NOTSET), 'NOTSET')
self.assertNotIn('sphinx', sys.modules)
self.assertEqual(repr(NOTSET), 'pyomo.common.flags.NOTSET')
self.assertIsNone(in_testing_environment.state)

self.assertTrue(in_testing_environment())
self.assertFalse(building_documentation())
try:
sys.modules['sphinx'] = sys.modules[__name__]
for i in sorted(sys.modules.items()):
print(i)
self.assertTrue(in_testing_environment())
self.assertTrue(building_documentation())
self.assertEqual(repr(NOTSET), 'pyomo.common.flags.NOTSET')
self.assertEqual(repr(NOTSET), 'NOTSET')

in_testing_environment(False)
self.assertFalse(in_testing_environment())
Expand Down

0 comments on commit a08fa45

Please sign in to comment.