Ejemplo n.º 1
0
 def test_error(self):
     class A(object): pass
     val = A()
     try:
         is_fixed(val)
         self.fail("Expected TypeError")
     except TypeError:
         pass
Ejemplo n.º 2
0
 def test_unknownNumericType(self):
     ref = MyBogusNumericType(42)
     self.assertTrue(is_fixed(ref))
     from pyomo.core.base.numvalue import native_numeric_types, native_types
     self.assertIn(MyBogusNumericType, native_numeric_types)
     self.assertIn(MyBogusNumericType, native_types)
     native_numeric_types.remove(MyBogusNumericType)
     native_types.remove(MyBogusNumericType)
Ejemplo n.º 3
0
 def test_const1(self):
     val = NumericConstant(1.0)
     self.assertTrue(is_fixed(val))
Ejemplo n.º 4
0
 def test_string(self):
     self.assertTrue(is_fixed('foo'))
Ejemplo n.º 5
0
 def test_long(self):
     val = int(1e10)
     self.assertTrue(is_fixed(val))
Ejemplo n.º 6
0
 def test_int(self):
     self.assertTrue(is_fixed(1))
Ejemplo n.º 7
0
 def test_float(self):
     self.assertTrue(is_fixed(1.1))
Ejemplo n.º 8
0
 def test_bool(self):
     self.assertTrue(is_fixed(True))
Ejemplo n.º 9
0
 def test_none(self):
     self.assertTrue(is_fixed(None))