- self.assertEqual(Constant(), self.zero)
- self.assertEqual(Constant(1), self.one)
- self.assertEqual(Constant(self.pi), self.pi)
- self.assertEqual(Constant('22/7'), self.pi)
+ self.assertEqual(self.x.name, 'x')
+ self.assertTrue(Dummy().name.startswith('Dummy'))
+
+ def test_eq(self):
+ self.assertEqual(self.x, self.x)
+ self.assertNotEqual(self.x, Symbol('x'))
+ self.assertNotEqual(Symbol('x'), self.x)
+ self.assertNotEqual(self.x, Dummy('x'))
+ self.assertNotEqual(Dummy(), Dummy())
+
+
+class TestRational(unittest.TestCase):
+
+ def setUp(self):
+ self.zero = Rational(0)
+ self.one = Rational(1)
+ self.pi = Rational(Fraction(22, 7))
+
+ def test_new(self):
+ self.assertEqual(Rational(), self.zero)
+ self.assertEqual(Rational(1), self.one)
+ self.assertEqual(Rational(self.pi), self.pi)
+ self.assertEqual(Rational('22/7'), self.pi)