X-Git-Url: https://svn.cri.ensmp.fr/git/linpy.git/blobdiff_plain/d06ab92943ec2e10a2bd798ca7c1b5cea395bf34..de11b4e658edf3ea876aaea3d3d681eaec13dcc4:/pypol/tests/test_linexprs.py diff --git a/pypol/tests/test_linexprs.py b/pypol/tests/test_linexprs.py index adfec7d..4c27b21 100644 --- a/pypol/tests/test_linexprs.py +++ b/pypol/tests/test_linexprs.py @@ -225,10 +225,38 @@ class TestSymbol(unittest.TestCase): 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]) + with self.assertRaises(TypeError): + symbols(1) + with self.assertRaises(TypeError): + symbols(['a', 1]) class TestRational(unittest.TestCase):