def testUnion(self): u = q.union() self.assertEqual('', str(u)) u = q.union(foo='fooval', bar='barval') self.assertEqual('(@foo:fooval|@bar:barval)', str(u)) u = q.union(q.intersect(foo=1, bar=2), q.intersect(foo=3, bar=4)) self.assertEqual('((@foo:1 @bar:2)|(@foo:3 @bar:4))', str(u))
def testSpecialNodes(self): u = q.union(num=q.between(1, 10)) self.assertEqual('@num:[1 10]', str(u)) u = q.union(num=[q.between(1, 10), q.between(100, 200)]) self.assertEqual('(@num:[1 10]|@num:[100 200])', str(u)) u = q.union( num=[q.tags('t1', 't2', 't3'), q.tags('t100', 't200', 't300')]) self.assertEqual('(@num:{t1 | t2 | t3}|@num:{t100 | t200 | t300})', str(u))