--- 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
"""