test/unittest_rqlrewrite.py
changeset 9358 1e0235478403
parent 9327 dbabdc323e7d
child 9593 48a84fb4f301
--- a/test/unittest_rqlrewrite.py	Wed Dec 11 12:22:52 2013 +0100
+++ b/test/unittest_rqlrewrite.py	Thu Dec 12 12:28:43 2013 +0100
@@ -486,6 +486,13 @@
         rqlst = parse('Any A, R WHERE A ref R, S is Affaire')
         rewrite(rqlst, {('A', 'X'): (c_ok, c_bad)}, {})
 
+    def test_nonregr_is_instance_of(self):
+        user_expr = ERQLExpression('NOT X in_group AF, AF name "guests"')
+        rqlst = parse('Any O WHERE S use_email O, S is CWUser, O is_instance_of EmailAddress')
+        rewrite(rqlst, {('S', 'X'): (user_expr,)}, {})
+        self.assertEqual(rqlst.as_string(),
+                         'Any O WHERE S use_email O, S is CWUser, O is EmailAddress, '
+                         'EXISTS(NOT S in_group A, A name "guests", A is CWGroup)')
 
 from cubicweb.devtools.testlib import CubicWebTC
 from logilab.common.decorators import classproperty