server/test/unittest_msplanner.py
branchstable
changeset 6131 087c5a168010
parent 6129 fea746b60093
child 6139 f76599a96238
child 6209 e3e5870807e9
equal deleted inserted replaced
6130:15fa8425b6e7 6131:087c5a168010
  1539                    {'x': 999999,})
  1539                    {'x': 999999,})
  1540 
  1540 
  1541     def test_crossed_relation_eid_2_needattr(self):
  1541     def test_crossed_relation_eid_2_needattr(self):
  1542         repo._type_source_cache[999999] = ('Note', 'cards', 999999)
  1542         repo._type_source_cache[999999] = ('Note', 'cards', 999999)
  1543         self._test('Any Y,T WHERE X eid %(x)s, X multisource_crossed_rel Y, Y type T',
  1543         self._test('Any Y,T WHERE X eid %(x)s, X multisource_crossed_rel Y, Y type T',
  1544                    [('FetchStep', [('Any Y,T WHERE Y type T, Y is Note', [{'T': 'String', 'Y': 'Note'}])],
  1544                    [('OneFetchStep', [('Any Y,T WHERE 999999 multisource_crossed_rel Y, Y type T, Y is Note',
  1545                      [self.cards, self.system], None,
  1545                                        [{'T': 'String', 'Y': 'Note'}])],
  1546                      {'T': 'table0.C1', 'Y': 'table0.C0', 'Y.type': 'table0.C1'}, []),
  1546                      None, None, [self.cards, self.system], {},
  1547                     ('UnionStep', None, None,
  1547                      []),
  1548                      [('OneFetchStep', [('Any Y,T WHERE 999999 multisource_crossed_rel Y, Y type T, Y is Note',
  1548                     ],
  1549                                          [{'T': 'String', 'Y': 'Note'}])],
       
  1550                        None, None, [self.cards], None,
       
  1551                        []),
       
  1552                       ('OneFetchStep', [('Any Y,T WHERE 999999 multisource_crossed_rel Y, Y type T, Y is Note',
       
  1553                                          [{'T': 'String', 'Y': 'Note'}])],
       
  1554                        None, None, [self.system],
       
  1555                        {'T': 'table0.C1', 'Y': 'table0.C0', 'Y.type': 'table0.C1'},
       
  1556                        [])]
       
  1557                      )],
       
  1558                    {'x': 999999,})
  1549                    {'x': 999999,})
  1559 
  1550 
  1560     def test_crossed_relation_eid_not_1(self):
  1551     def test_crossed_relation_eid_not_1(self):
  1561         repo._type_source_cache[999999] = ('Note', 'system', 999999)
  1552         repo._type_source_cache[999999] = ('Note', 'system', 999999)
  1562         self._test('Any Y WHERE X eid %(x)s, NOT X multisource_crossed_rel Y',
  1553         self._test('Any Y WHERE X eid %(x)s, NOT X multisource_crossed_rel Y',
  1787         self.repo._type_source_cache[999999] = ('Note', 'cards', 999999)
  1778         self.repo._type_source_cache[999999] = ('Note', 'cards', 999999)
  1788         self.cards.support_relations['see_also'] = True
  1779         self.cards.support_relations['see_also'] = True
  1789         self.cards.cross_relations.add('see_also')
  1780         self.cards.cross_relations.add('see_also')
  1790         try:
  1781         try:
  1791             self._test('Any X,AA ORDERBY AA WHERE E eid %(x)s, E see_also X, X modification_date AA',
  1782             self._test('Any X,AA ORDERBY AA WHERE E eid %(x)s, E see_also X, X modification_date AA',
  1792                        [('FetchStep', [('Any X,AA WHERE X modification_date AA, X is Note',
  1783                        [('AggrStep',
  1793                                         [{'AA': 'Datetime', 'X': 'Note'}])],
  1784                          'SELECT table0.C0, table0.C1 FROM table0 ORDER BY table0.C1',
  1794                          [self.cards, self.system], None,
       
  1795                          {'AA': 'table0.C1', 'X': 'table0.C0',
       
  1796                           'X.modification_date': 'table0.C1'},
       
  1797                          []),
       
  1798                         ('AggrStep', 'SELECT table1.C0, table1.C1 FROM table1 ORDER BY table1.C1',
       
  1799                          None,
  1785                          None,
  1800                          [('FetchStep', [('Any X,AA WHERE 999999 see_also X, X modification_date AA, X is IN(Bookmark)',
  1786                          [('FetchStep',
  1801                                           [{'AA': 'Datetime', 'X': 'Bookmark'}])],
  1787                            [('Any X,AA WHERE 999999 see_also X, X modification_date AA, X is Note',
  1802                            [self.cards, self.system],
  1788                              [{'AA': 'Datetime', 'X': 'Note'}])], [self.cards, self.system], {},
  1803                            {},
  1789                            {'AA': 'table0.C1', 'X': 'table0.C0',
  1804                            {'AA': 'table1.C1',
  1790                             'X.modification_date': 'table0.C1'},
  1805                             'X': 'table1.C0', 'X.modification_date': 'table1.C1'},
       
  1806                            []),
  1791                            []),
  1807                           ('FetchStep',
  1792                           ('FetchStep',
  1808                            [('Any X,AA WHERE 999999 see_also X, X modification_date AA, X is IN(Note)',
  1793                            [('Any X,AA WHERE 999999 see_also X, X modification_date AA, X is Bookmark',
  1809                              [{'AA': 'Datetime', 'X': 'Note'}])],
  1794                              [{'AA': 'Datetime', 'X': 'Bookmark'}])],
  1810                            [self.cards],
  1795                            [self.system], {},
  1811                            None,
  1796                            {'AA': 'table0.C1', 'X': 'table0.C0',
  1812                            {'AA': 'table1.C1',
  1797                             'X.modification_date': 'table0.C1'},
  1813                             'X': 'table1.C0', 'X.modification_date': 'table1.C1'},
  1798                            [])])],
  1814                            []),
       
  1815                           ('FetchStep',
       
  1816                            [('Any X,AA WHERE 999999 see_also X, X modification_date AA, X is IN(Note)',
       
  1817                              [{'AA': 'Datetime', 'X': 'Note'}])],
       
  1818                            [self.system],
       
  1819                            {'AA': 'table0.C1',
       
  1820                             'X': 'table0.C0', 'X.modification_date': 'table0.C1'},
       
  1821                            {'AA': 'table1.C1',
       
  1822                             'X': 'table1.C0', 'X.modification_date': 'table1.C1'},
       
  1823                            [])]
       
  1824                          )],
       
  1825                          {'x': 999999})
  1799                          {'x': 999999})
  1826         finally:
  1800         finally:
  1827             del self.cards.support_relations['see_also']
  1801             del self.cards.support_relations['see_also']
  1828             self.cards.cross_relations.remove('see_also')
  1802             self.cards.cross_relations.remove('see_also')
  1829 
  1803 
  1941                    {'n': 999999})
  1915                    {'n': 999999})
  1942 
  1916 
  1943     def test_nonregr8(self):
  1917     def test_nonregr8(self):
  1944         repo._type_source_cache[999999] = ('Note', 'cards', 999999)
  1918         repo._type_source_cache[999999] = ('Note', 'cards', 999999)
  1945         self._test('Any X,Z WHERE X eid %(x)s, X multisource_rel Y, Z concerne X',
  1919         self._test('Any X,Z WHERE X eid %(x)s, X multisource_rel Y, Z concerne X',
  1946                    [('FetchStep', [('Any  WHERE 999999 multisource_rel Y, Y is Note', [{'Y': 'Note'}])],
  1920                    [('FetchStep', [('Any 999999 WHERE 999999 multisource_rel Y, Y is Note',
  1947                      [self.cards], None, {}, []),
  1921                                     [{'Y': 'Note'}])],
       
  1922                      [self.cards],
       
  1923                      None, {u'%(x)s': 'table0.C0'},
       
  1924                      []),
  1948                     ('OneFetchStep', [('Any 999999,Z WHERE Z concerne 999999, Z is Affaire',
  1925                     ('OneFetchStep', [('Any 999999,Z WHERE Z concerne 999999, Z is Affaire',
  1949                                        [{'Z': 'Affaire'}])],
  1926                                        [{'Z': 'Affaire'}])],
  1950                      None, None, [self.system], {}, [])],
  1927                      None, None, [self.system],
       
  1928                      {u'%(x)s': 'table0.C0'}, []),
       
  1929                     ],
  1951                    {'x': 999999})
  1930                    {'x': 999999})
  1952 
  1931 
  1953     def test_nonregr9(self):
  1932     def test_nonregr9(self):
  1954         repo._type_source_cache[999999] = ('Note', 'cards', 999999)
  1933         repo._type_source_cache[999999] = ('Note', 'cards', 999999)
  1955         repo._type_source_cache[999998] = ('Note', 'cards', 999998)
  1934         repo._type_source_cache[999998] = ('Note', 'cards', 999998)