test/unittest_schema.py
changeset 3998 94cc7cad3d2d
parent 3877 7ca53fc72a0a
parent 3978 2c95e3033f64
child 4181 c79135c217df
--- a/test/unittest_schema.py	Mon Nov 23 14:13:53 2009 +0100
+++ b/test/unittest_schema.py	Thu Dec 03 17:17:43 2009 +0100
@@ -18,9 +18,11 @@
 from yams.buildobjs import RelationDefinition, EntityType, RelationType
 from yams.reader import PyFileReader
 
-from cubicweb.schema import CubicWebSchema, CubicWebEntitySchema, \
-     RQLConstraint, CubicWebSchemaLoader, RQLExpression, ERQLExpression, RRQLExpression, \
-     normalize_expression, order_eschemas
+from cubicweb.schema import (
+    CubicWebSchema, CubicWebEntitySchema, CubicWebSchemaLoader,
+    RQLConstraint, RQLUniqueConstraint, RQLVocabularyConstraint,
+    RQLExpression, ERQLExpression, RRQLExpression,
+    normalize_expression, order_eschemas)
 from cubicweb.devtools import TestServerConfiguration as TestConfiguration
 
 DATADIR = join(dirname(__file__), 'data')
@@ -83,6 +85,18 @@
 
 class CubicWebSchemaTC(TestCase):
 
+    def test_rql_constraints_inheritance(self):
+        # isinstance(cstr, RQLVocabularyConstraint)
+        # -> expected to return RQLVocabularyConstraint and RQLConstraint
+        #   instances but not RQLUniqueConstraint
+        #
+        # isinstance(cstr, RQLConstraint)
+        # -> expected to return RQLConstraint instances but not
+        #    RRQLVocabularyConstraint and QLUniqueConstraint
+        self.failIf(issubclass(RQLUniqueConstraint, RQLVocabularyConstraint))
+        self.failIf(issubclass(RQLUniqueConstraint, RQLConstraint))
+        self.failUnless(issubclass(RQLConstraint, RQLVocabularyConstraint))
+
     def test_normalize(self):
         """test that entities, relations and attributes name are normalized
         """