Ejemplo n.º 1
0
 def test_set_func(self):
     cdi = ComponentDataItem(parent=None, ui_data=None, o=self.m.x[1])
     self.assertIsNone(cdi.set("test_val", 5))
     self.assertIsNone(cdi.get("test_val")) # test can't set
     cdi = ComponentDataItem(parent=None, ui_data=None, o=self.m.x)
     self.assertIsNone(cdi.set("test_val", 5))
     self.assertEqual(cdi.get("test_val"), 5) # test can set with no callback
Ejemplo n.º 2
0
 def test_var_fixed_bounds(self):
     cdi = ComponentDataItem(parent=None, ui_setup=None, o=self.m.x[1])
     cdi.set("fixed", True)
     self.assertTrue(cdi.get("fixed"))
     cdi.set("fixed", False)
     self.assertFalse(cdi.get("fixed"))
Ejemplo n.º 3
0
 def test_var_set_bounds(self):
     cdi = ComponentDataItem(parent=None, ui_setup=None, o=self.m.x[1])
     cdi.set("lb", 2)
     cdi.set("ub", 8)
     self.assertAlmostEqual(cdi.get("lb"), 2)
     self.assertAlmostEqual(cdi.get("ub"), 8)
Ejemplo n.º 4
0
 def test_var_fixed_bounds(self):
     cdi = ComponentDataItem(parent=None, ui_data=None, o=self.m.x[1])
     cdi.set("fixed", True)
     self.assertTrue(cdi.get("fixed"))
     cdi.set("fixed", False)
     self.assertFalse(cdi.get("fixed"))
Ejemplo n.º 5
0
 def test_var_set_bounds(self):
     cdi = ComponentDataItem(parent=None, ui_data=None, o=self.m.x[1])
     cdi.set("lb", 2)
     cdi.set("ub", 8)
     self.assertAlmostEqual(cdi.get("lb"), 2)
     self.assertAlmostEqual(cdi.get("ub"), 8)
Ejemplo n.º 6
0
 def test_var_fixed_bounds(self):
     cdi = ComponentDataItem(parent=None, ui_setup=None, o=self.m.x[1])
     cdi.set("fixed", True)
     assert(cdi.get("fixed"))
     cdi.set("fixed", False)
     assert(not cdi.get("fixed"))
Ejemplo n.º 7
0
 def test_var_set_bounds(self):
     cdi = ComponentDataItem(parent=None, ui_setup=None, o=self.m.x[1])
     cdi.set("lb", 2)
     cdi.set("ub", 8)
     assert(abs(cdi.get("lb") - 2) < 0.0001)
     assert(abs(cdi.get("ub") - 8) < 0.0001)