test/unittest_rqlrewrite.py
changeset 9358 1e0235478403
parent 9327 dbabdc323e7d
child 9593 48a84fb4f301
equal deleted inserted replaced
9348:eacd02792332 9358:1e0235478403
   484         c_bad = ERQLExpression('X documented_by R, A in_state R')
   484         c_bad = ERQLExpression('X documented_by R, A in_state R')
   485 
   485 
   486         rqlst = parse('Any A, R WHERE A ref R, S is Affaire')
   486         rqlst = parse('Any A, R WHERE A ref R, S is Affaire')
   487         rewrite(rqlst, {('A', 'X'): (c_ok, c_bad)}, {})
   487         rewrite(rqlst, {('A', 'X'): (c_ok, c_bad)}, {})
   488 
   488 
       
   489     def test_nonregr_is_instance_of(self):
       
   490         user_expr = ERQLExpression('NOT X in_group AF, AF name "guests"')
       
   491         rqlst = parse('Any O WHERE S use_email O, S is CWUser, O is_instance_of EmailAddress')
       
   492         rewrite(rqlst, {('S', 'X'): (user_expr,)}, {})
       
   493         self.assertEqual(rqlst.as_string(),
       
   494                          'Any O WHERE S use_email O, S is CWUser, O is EmailAddress, '
       
   495                          'EXISTS(NOT S in_group A, A name "guests", A is CWGroup)')
   489 
   496 
   490 from cubicweb.devtools.testlib import CubicWebTC
   497 from cubicweb.devtools.testlib import CubicWebTC
   491 from logilab.common.decorators import classproperty
   498 from logilab.common.decorators import classproperty
   492 
   499 
   493 class RewriteFullTC(CubicWebTC):
   500 class RewriteFullTC(CubicWebTC):