Updated Makefile
[linpy.git] / tests / test_linear.py
index 039ffc7..2375092 100644 (file)
@@ -1,4 +1,3 @@
-
 import unittest
 
 from fractions import Fraction
 import unittest
 
 from fractions import Fraction
@@ -83,13 +82,6 @@ class TestExpression(unittest.TestCase):
     def test_values(self):
         self.assertCountEqual(self.expr.values(), [1, -2, 3])
 
     def test_values(self):
         self.assertCountEqual(self.expr.values(), [1, -2, 3])
 
-    def test_symbol(self):
-        self.assertEqual(self.x.symbol, 'x')
-        with self.assertRaises(ValueError):
-            self.pi.symbol
-        with self.assertRaises(ValueError):
-            self.expr.symbol
-
     def test_issymbol(self):
         self.assertTrue(self.x.issymbol())
         self.assertFalse(self.pi.issymbol())
     def test_issymbol(self):
         self.assertTrue(self.x.issymbol())
         self.assertFalse(self.pi.issymbol())
@@ -139,9 +131,9 @@ class TestExpression(unittest.TestCase):
     def test_repr(self):
         self.assertEqual(repr(self.x), "Symbol('x')")
         self.assertEqual(repr(self.one), 'Constant(1)')
     def test_repr(self):
         self.assertEqual(repr(self.x), "Symbol('x')")
         self.assertEqual(repr(self.one), 'Constant(1)')
+        self.assertEqual(repr(self.pi), 'Constant(22, 7)')
         self.assertEqual(repr(self.expr), "Expression({'x': 1, 'y': -2}, 3)")
 
         self.assertEqual(repr(self.expr), "Expression({'x': 1, 'y': -2}, 3)")
 
-    @unittest.expectedFailure
     def test_fromstring(self):
         self.assertEqual(Expression.fromstring('x'), self.x)
         self.assertEqual(Expression.fromstring('-x'), -self.x)
     def test_fromstring(self):
         self.assertEqual(Expression.fromstring('x'), self.x)
         self.assertEqual(Expression.fromstring('-x'), -self.x)
@@ -171,6 +163,9 @@ class TestSymbol(unittest.TestCase):
         self.x = Symbol('x')
         self.y = Symbol('y')
 
         self.x = Symbol('x')
         self.y = Symbol('y')
 
+    def test_name(self):
+        self.assertEqual(self.x.name, 'x')
+
     def test_symbols(self):
         self.assertListEqual(list(symbols('x y')), [self.x, self.y])
         self.assertListEqual(list(symbols('x,y')), [self.x, self.y])
     def test_symbols(self):
         self.assertListEqual(list(symbols('x y')), [self.x, self.y])
         self.assertListEqual(list(symbols('x,y')), [self.x, self.y])