Beispiel #1
0
 def test_init(self):
     """Test initialization via both operator overloading and __init__"""
     x = Variable('x')
     y = Variable('y')
     mono = y**2/x
     # operator overloading
     mec = (x == y**2)
     # __init__
     mec2 = MonomialEquality(x, "=", y**2)
     self.assertTrue(mono in mec.as_posyslt1())
     self.assertTrue(mono in mec2.as_posyslt1())
Beispiel #2
0
 def test_init(self):
     """Test initialization via both operator overloading and __init__"""
     x = Variable('x')
     y = Variable('y')
     mono = y**2 / x
     # operator overloading
     mec = (x == y**2)
     # __init__
     mec2 = MonomialEquality(x, "=", y**2)
     self.assertTrue(mono in mec.as_posyslt1())
     self.assertTrue(mono in mec2.as_posyslt1())
     x = Variable("x", "ft")
     y = Variable("y")
     if gpkit.units:
         self.assertRaises(ValueError, MonomialEquality, x, "=", y)
         self.assertRaises(ValueError, MonomialEquality, y, "=", x)
Beispiel #3
0
 def test_init(self):
     """Test initialization via both operator overloading and __init__"""
     x = Variable('x')
     y = Variable('y')
     mono = y**2/x
     # operator overloading
     mec = (x == y**2)
     # __init__
     mec2 = MonomialEquality(x, "=", y**2)
     self.assertTrue(mono in mec.as_posyslt1())
     self.assertTrue(mono in mec2.as_posyslt1())
     x = Variable("x", "ft")
     y = Variable("y")
     if gpkit.units:
         self.assertRaises(ValueError, MonomialEquality, x, "=", y)
         self.assertRaises(ValueError, MonomialEquality, y, "=", x)