Swap order of symbols and Dummy
[linpy.git] / pypol / tests / test_linexprs.py
index adfec7d..4c27b21 100644 (file)
@@ -225,10 +225,38 @@ class TestSymbol(unittest.TestCase):
         with self.assertRaises(TypeError):
             Symbol.fromsympy(sp_x*sp_x)
 
         with self.assertRaises(TypeError):
             Symbol.fromsympy(sp_x*sp_x)
 
-    def test_symbols(self):
+
+class TestDummy(unittest.TestCase):
+
+    def setUp(self):
+        self.x = Dummy('x')
+
+    def test_new(self):
+        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 TestSymbols(unittest.TestCase):
+
+    def setUp(self):
+        self.x = Symbol('x')
+        self.y = Symbol('y')
+
+    def test(self):
         self.assertListEqual(list(symbols('x y')), [self.x, self.y])
         self.assertListEqual(list(symbols('x,y')), [self.x, self.y])
         self.assertListEqual(list(symbols(['x', 'y'])), [self.x, self.y])
         self.assertListEqual(list(symbols('x y')), [self.x, self.y])
         self.assertListEqual(list(symbols('x,y')), [self.x, self.y])
         self.assertListEqual(list(symbols(['x', 'y'])), [self.x, self.y])
+        with self.assertRaises(TypeError):
+            symbols(1)
+        with self.assertRaises(TypeError):
+            symbols(['a', 1])
 
 
 class TestRational(unittest.TestCase):
 
 
 class TestRational(unittest.TestCase):