Commit 57c4ee10 authored by Vincent Pelletier's avatar Vincent Pelletier

Fix embeded tests to use 'and' as implicit logical operator.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26801 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8944f9c7
......@@ -173,10 +173,10 @@ if __name__ == '__main__':
('-1', None),
('foo OR "-" OR bar OR -baz', ComplexQuery([Query(None, 'foo'), Query(None, '-'), Query(None, 'bar'), Query(None, '-baz')], operator='or')),
('foo "-" bar -baz', ComplexQuery([Query(None, 'foo'), Query(None, '-'), Query(None, 'bar'), Query(None, '-baz')], operator='or')),
('foo "-" bar -baz', ComplexQuery([Query(None, 'foo'), Query(None, '-'), Query(None, 'bar'), Query(None, '-baz')], operator='and')),
('title:foo', Query('title', 'foo')),
('title: foo', Query('title', 'foo')),
('title:foo bar', ComplexQuery([Query('title', 'foo'), Query(None, 'bar')], operator='or')),
('title:foo bar', ComplexQuery([Query('title', 'foo'), Query(None, 'bar')], operator='and')),
('title:"foo bar"', Query('title', 'foo bar')),
('"title:foo bar"', Query(None, 'title:foo bar')),
('"foo bar"', Query(None, 'foo bar')),
......@@ -193,18 +193,18 @@ if __name__ == '__main__':
('">1"', Query(None, '>1')),
('>a', Query(None, 'a', '>')),
('">a"', Query(None, '>a')),
('>1 0', ComplexQuery([Query(None, '1', '>'), Query(None, '0')], operator='or')),
('>1 0', ComplexQuery([Query(None, '1', '>'), Query(None, '0')], operator='and')),
('>=1', Query(None, '1', '>=')),
('>"=1"', Query(None, '=1', '>')),
('-"1"', ComplexQuery([Query(None, '-'), Query(None, '1')], operator='or')),
('-"1"', ComplexQuery([Query(None, '-'), Query(None, '1')], operator='and')),
('"!-1"', Query(None, '!-1')),
# (r"a:'tu:\'tu\''", ['a', "tu:'tu'"]),
(r'''b:"tu:\'tu\'"''', Query('b', "tu:\\'tu\\'")),
(r'''c:"tu:'tu'"''', Query('c', "tu:'tu'")),
(r'd:"tu:\"tu\""', Query('d', 'tu:"tu"')),
('toto: tutu tutu', ComplexQuery([Query('toto', 'tutu'), Query(None, 'tutu')], operator='or')),
('(tutu) (toto:tata)', ComplexQuery([Query(None, 'tutu'), Query('toto', 'tata')], operator='or')),
('(tutu) (toto:"tata")', ComplexQuery([Query(None, 'tutu'), Query('toto', 'tata')], operator='or')),
('toto: tutu tutu', ComplexQuery([Query('toto', 'tutu'), Query(None, 'tutu')], operator='and')),
('(tutu) (toto:tata)', ComplexQuery([Query(None, 'tutu'), Query('toto', 'tata')], operator='and')),
('(tutu) (toto:"tata")', ComplexQuery([Query(None, 'tutu'), Query('toto', 'tata')], operator='and')),
# ('toto:', ['toto', '']),
('toto:""', Query('toto', '')),
# ("''", ''),
......@@ -221,8 +221,8 @@ if __name__ == '__main__':
('(foo OR bar)', ComplexQuery([Query(None, 'foo'), Query(None, 'bar')], operator='or')),
('(a AND b) OR (c AND (d OR e))',
ComplexQuery([ComplexQuery([Query(None, 'a'), Query(None, 'b')], operator='and'), ComplexQuery([Query(None, 'c'), ComplexQuery([Query(None, 'd'), Query(None, 'e')], operator='or')], operator='and')], operator='or')),
('(foo:"") (bar:baz)', ComplexQuery([Query('foo', ''), Query('bar', 'baz')], operator='or')),
('(foo:"") (OR:bar)', ComplexQuery([Query('foo', ''), Query('OR', 'bar')], operator='or')),
('(foo:"") (bar:baz)', ComplexQuery([Query('foo', ''), Query('bar', 'baz')], operator='and')),
('(foo:"") (OR:bar)', ComplexQuery([Query('foo', ''), Query('OR', 'bar')], operator='and')),
# ('foo: OR', ['foo', 'or']),
# ('foo: OR ', ['foo', 'or']),
# ('(foo:)', ['foo', '']),
......@@ -236,7 +236,7 @@ if __name__ == '__main__':
('"JeanANDPaul"', Query(None, 'JeanANDPaul')),
('"Jean" AND "Paul"', ComplexQuery([Query(None, 'Jean'), Query(None, 'Paul')], operator='and')),
('"jean paul" OR "thierry"', ComplexQuery([Query(None, 'jean paul'), Query(None, 'thierry')], operator='or')),
('title:Paul Jean Lili', ComplexQuery([Query('title', 'Paul'), Query(None, 'Jean'), Query(None, 'Lili')], operator='or')),
('title:Paul Jean Lili', ComplexQuery([Query('title', 'Paul'), Query(None, 'Jean'), Query(None, 'Lili')], operator='and')),
('toto AND titi OR tutu AND tata OR toto',
ComplexQuery([ComplexQuery([Query(None, 'toto'), Query(None, 'titi')], operator='and'), ComplexQuery([Query(None, 'tutu'), Query(None, 'tata')], operator='and'), Query(None, 'toto')], operator='or')),
('toto AND (titi OR tutu) AND tata OR toto',
......@@ -244,15 +244,18 @@ if __name__ == '__main__':
('"OR ARGENT"', Query(None, 'OR ARGENT')),
('1 AND 2 OR 3', ComplexQuery([ComplexQuery([Query(None, '1'), Query(None, '2')], operator='and'), Query(None, '3')], operator='or')),
('1 OR 2 AND 3', ComplexQuery([Query(None, '1'), ComplexQuery([Query(None, '2'), Query(None, '3')], operator='and')], operator='or')),
('1 AND 2 3', ComplexQuery([ComplexQuery([Query(None, '1'), Query(None, '2')], operator='and'), Query(None, '3')], operator='or')),
('1 2 AND 3', ComplexQuery([Query(None, '1'), ComplexQuery([Query(None, '2'), Query(None, '3')], operator='and')], operator='or')),
('10 11 OR 12 13', ComplexQuery([Query(None, '10'), Query(None, '11'), Query(None, '12'), Query(None, '13')], operator='or')),
('((1 AND 2 OR 3) OR (4 AND 5 6) OR (7 8 AND 9) OR (10 11 OR 12 13))',
ComplexQuery([ComplexQuery([Query(None, '1'), Query(None, '2')], operator='and'), Query(None, '3'), ComplexQuery([Query(None, '4'), Query(None, '5')], operator='and'), Query(None, '6'), Query(None, '7'), ComplexQuery([Query(None, '8'), Query(None, '9')], operator='and'), Query(None, '10'), Query(None, '11'), Query(None, '12'), Query(None, '13')], operator='or')),
('1 AND 2 3', ComplexQuery([Query(None, '1'), Query(None, '2'), Query(None, '3')], operator='and')),
('1 2 AND 3', ComplexQuery([Query(None, '1'), Query(None, '2'), Query(None, '3')], operator='and')),
('10 11 AND 12 13', ComplexQuery([Query(None, '10'), Query(None, '11'), Query(None, '12'), Query(None, '13')], operator='and')),
('1 OR 2 3', ComplexQuery([Query(None, '1'), ComplexQuery([Query(None, '2'), Query(None, '3')], operator='and')], operator='or')),
('1 2 OR 3', ComplexQuery([ComplexQuery([Query(None, '1'), Query(None, '2')], operator='and'), Query(None, '3')], operator='or')),
('10 11 OR 12 13', ComplexQuery([ComplexQuery([Query(None, '10'), Query(None, '11')], operator='and'), ComplexQuery([Query(None, '12'), Query(None, '13')], operator='and')], operator='or')),
('((1 AND 2 OR 3) OR (4 OR 5 6) OR (7 8 OR 9) OR (10 11 OR 12 13))',
ComplexQuery([ComplexQuery([Query(None, '1', '='), Query(None, '2', '=')], operator='and'), Query(None, '3', '='), Query(None, '4', '='), ComplexQuery([Query(None, '5', '='), Query(None, '6', '=')], operator='and'), ComplexQuery([Query(None, '7', '='), Query(None, '8', '=')], operator='and'), Query(None, '9', '='), ComplexQuery([Query(None, '10', '='), Query(None, '11', '=')], operator='and'), ComplexQuery([Query(None, '12', '='), Query(None, '13', '=')], operator='and')], operator='or')),
('((titi:foo) AND (toto:bar)) OR ((titi:bar) AND (toto:foo))',
ComplexQuery([ComplexQuery([Query('titi', 'foo'), Query('toto', 'bar')], operator='and'), ComplexQuery([Query('titi', 'bar'), Query('toto', 'foo')], operator='and')], operator='or')),
('title:(Paul Jean OR Lili)', ComplexQuery([Query('title', 'Paul'), Query('title', 'Jean'), Query('title', 'Lili')], operator='or')),
('title:Paul Jean OR Lili', ComplexQuery([Query('title', 'Paul'), Query(None, 'Jean'), Query(None, 'Lili')], operator='or')),
('title:Paul Jean OR Lili', ComplexQuery([ComplexQuery([Query('title', 'Paul'), Query(None, 'Jean')], operator='and'), Query(None, 'Lili')], operator='or')),
]
def walk(node, key=None):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment