Beispiel #1
0
 def test_error(self):
     class A(object): pass
     val = A()
     try:
         is_fixed(val)
         self.fail("Expected TypeError")
     except TypeError:
         pass
Beispiel #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)
Beispiel #3
0
 def test_const1(self):
     val = NumericConstant(1.0)
     self.assertTrue(is_fixed(val))
Beispiel #4
0
 def test_string(self):
     self.assertTrue(is_fixed('foo'))
Beispiel #5
0
 def test_long(self):
     val = int(1e10)
     self.assertTrue(is_fixed(val))
Beispiel #6
0
 def test_int(self):
     self.assertTrue(is_fixed(1))
Beispiel #7
0
 def test_float(self):
     self.assertTrue(is_fixed(1.1))
Beispiel #8
0
 def test_bool(self):
     self.assertTrue(is_fixed(True))
Beispiel #9
0
 def test_none(self):
     self.assertTrue(is_fixed(None))