Example #1
0
 def test_find_component_deprecated(self):
     ref = self.m.b[1, '2'].c.a[3]
     cuid = ComponentUID(ref)
     DEP_OUT = StringIO()
     with LoggingIntercept(DEP_OUT, 'pyomo.core'):
         self.assertTrue(cuid.find_component(self.m) is ref)
     self.assertIn('ComponentUID.find_component() is deprecated.',
                   DEP_OUT.getvalue())
Example #2
0
 def test_find_implicit_notExists_1(self):
     cuid = ComponentUID('b:1,2.c.a:4')
     self.assertTrue(cuid.find_component(self.m) is None)
Example #3
0
 def test_find_explicit_notExists_2(self):
     cuid = ComponentUID('b:$1,2.c.a:3')
     self.assertTrue(cuid.find_component(self.m) is None)
Example #4
0
 def test_find_implicit_exists(self):
     cuid = ComponentUID('b:1,2.c.a:3')
     self.assertTrue(cuid.find_component(self.m) is self.m.b[1, '2'].c.a[3])
Example #5
0
 def test_find_wildcard_exists_3(self):
     cuid = ComponentUID('b[*,*]')
     self.assertTrue(cuid.find_component(self.m) is self.m.b)
Example #6
0
 def test_find_wildcard_exists_2(self):
     cuid = ComponentUID('b:1,2.c.a:*')
     self.assertTrue(cuid.find_component(self.m) is self.m.b[1, '2'].c.a)
Example #7
0
 def test_find_wildcard_exists_1(self):
     ref = self.m.b[1, '2'].c.a
     cuid = ComponentUID(ref)
     self.assertTrue(cuid.find_component(self.m) is ref)
Example #8
0
 def test_find_explicit_exists(self):
     ref = self.m.b[1, '2'].c.a[3]
     cuid = ComponentUID(ref)
     self.assertTrue(cuid.find_component(self.m) is ref)