add test and fix for queries where all variables are simplified and come from an external source stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 15 Jun 2009 18:26:31 +0200
branchstable
changeset 2108 b3f6fa7ad59f
parent 2107 6c4a4c514ac2
child 2109 f469368df530
add test and fix for queries where all variables are simplified and come from an external source
server/msplanner.py
server/test/unittest_msplanner.py
--- a/server/msplanner.py	Mon Jun 15 12:42:48 2009 +0200
+++ b/server/msplanner.py	Mon Jun 15 18:26:31 2009 +0200
@@ -352,6 +352,8 @@
             if source is self.system_source:
                 for const in vconsts:
                     self._set_source_for_term(source, const)
+            elif not self._sourcesterms:
+                self._set_source_for_term(source, const)
             elif source in self._sourcesterms:
                 source_scopes = frozenset(t.scope for t in self._sourcesterms[source])
                 for const in vconsts:
--- a/server/test/unittest_msplanner.py	Mon Jun 15 12:42:48 2009 +0200
+++ b/server/test/unittest_msplanner.py	Mon Jun 15 18:26:31 2009 +0200
@@ -2110,6 +2110,14 @@
                      [])
                     ])
 
+    def test_fully_simplified_extsource(self):
+        self.repo._type_source_cache[999998] = ('Note', 'vcs', 999998)
+        self.repo._type_source_cache[999999] = ('Note', 'vcs', 999999)
+        self._test('Any X, Y WHERE NOT X multisource_rel Y, X eid 999998, Y eid 999999',
+                   [('OneFetchStep', [('Any 999998,999999 WHERE NOT 999998 multisource_rel 999999', [{}])],
+                     None, None, [self.vcs], {}, [])
+                    ])
+
 
 if __name__ == '__main__':
     from logilab.common.testlib import unittest_main