# HG changeset patch # User Sylvain Thénault # Date 1249633337 -7200 # Node ID 405c09e7df6e4c9c6e7f6988410037cd33a1b5f0 # Parent 6df328b47361579c951402e33e87de469b11146e [rql test] add non regression test for rql (fail with current rql head) diff -r 6df328b47361 -r 405c09e7df6e server/test/unittest_rql2sql.py --- a/server/test/unittest_rql2sql.py Fri Aug 07 10:21:39 2009 +0200 +++ b/server/test/unittest_rql2sql.py Fri Aug 07 10:22:17 2009 +0200 @@ -1120,6 +1120,32 @@ ] from logilab.common.adbh import ADV_FUNC_HELPER_DIRECTORY +class CWRQLTC(RQLGeneratorTC): + schema = schema + + def test_nonregr_sol(self): + delete = self.rqlhelper.parse( + 'DELETE X read_permission READ_PERMISSIONSUBJECT,X add_permission ADD_PERMISSIONSUBJECT,' + 'X in_basket IN_BASKETSUBJECT,X delete_permission DELETE_PERMISSIONSUBJECT,' + 'X initial_state INITIAL_STATESUBJECT,X update_permission UPDATE_PERMISSIONSUBJECT,' + 'X created_by CREATED_BYSUBJECT,X is ISSUBJECT,X is_instance_of IS_INSTANCE_OFSUBJECT,' + 'X owned_by OWNED_BYSUBJECT,X specializes SPECIALIZESSUBJECT,ISOBJECT is X,' + 'SPECIALIZESOBJECT specializes X,STATE_OFOBJECT state_of X,IS_INSTANCE_OFOBJECT is_instance_of X,' + 'TO_ENTITYOBJECT to_entity X,TRANSITION_OFOBJECT transition_of X,FROM_ENTITYOBJECT from_entity X ' + 'WHERE X is CWEType') + self.rqlhelper.compute_solutions(delete) + def var_sols(var): + s = set() + for sol in delete.solutions: + s.add(sol.get(var)) + return s + self.assertEquals(var_sols('FROM_ENTITYOBJECT'), set(('CWAttribute', 'CWRelation'))) + self.assertEquals(var_sols('FROM_ENTITYOBJECT'), delete.defined_vars['FROM_ENTITYOBJECT'].stinfo['possibletypes']) + self.assertEquals(var_sols('ISOBJECT'), + set(x.type for x in self.schema.entities() if not x.is_final())) + self.assertEquals(var_sols('ISOBJECT'), delete.defined_vars['ISOBJECT'].stinfo['possibletypes']) + + class PostgresSQLGeneratorTC(RQLGeneratorTC): schema = schema