Better implementation of Expression.__repr__
[linpy.git] / pypol / tests / test_domains.py
index df7b01c..4d38075 100644 (file)
@@ -38,10 +38,13 @@ class TestDomain(unittest.TestCase):
 
     def test_disjoint(self):
         self.assertEqual(self.square1.disjoint(), self.disjoint)
+        self.assertEqual(self.empty.disjoint(), Empty)
+        self.assertEqual(self.universe.disjoint(), self.universe)
 
     def test_isempty(self):
         self.assertFalse(self.square1.isempty())
         self.assertTrue(self.empty.isempty())
+        self.assertFalse(self.universe.isempty())
 
     def test_isuniverse(self):
         self.assertFalse(self.square1.isuniverse())
@@ -54,6 +57,7 @@ class TestDomain(unittest.TestCase):
     def test_eq(self):
         self.assertTrue(self.square1 == self.square1)
         self.assertFalse(self.square1 == self.square2)
+        self.assertFalse(self.empty == self.universe)
 
     def test_isdisjoint(self):
         self.assertFalse(self.square1.isdisjoint(self.square2))        
@@ -147,3 +151,13 @@ class TestDomain(unittest.TestCase):
         self.assertEqual(self.square1.lexmax(), self.lexmax)
         self.assertEqual(self.universe.lexmax(), self.universe)
         self.assertEqual(self.empty.lexmax(), Empty)
+        
+    def test_num_parameters(self):
+        self.assertEqual(self.square1.num_parameters(), 2)
+        self.assertEqual(self.empty.num_parameters(), 0)
+        self.assertEqual(self.universe.num_parameters(), 0)
+        
+    def test_involves_dims(self):
+        self.assertTrue(self.square1.involves_dims(symbols('x y')))
+        self.assertFalse(self.empty.involves_dims(symbols('x')))
+        self.assertFalse(self.universe.involves_dims(symbols('x')))