Commit 8e7e6d90 authored by Vincent Pelletier's avatar Vincent Pelletier

Fix capitalised words starting with an operator name.

Word prefix used to be detected as an actual operator.
Add a test.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40393 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 52a275e8
...@@ -112,15 +112,15 @@ class lexer(object): ...@@ -112,15 +112,15 @@ class lexer(object):
return t return t
def t_OR(self, t): def t_OR(self, t):
r'OR' r'OR[ ]'
return t return t
def t_AND(self, t): def t_AND(self, t):
r'AND' r'AND[ ]'
return t return t
def t_NOT(self, t): def t_NOT(self, t):
r'NOT' r'NOT[ ]'
return t return t
def t_WORD(self, t): def t_WORD(self, t):
......
...@@ -646,6 +646,15 @@ class TestSQLCatalog(unittest.TestCase): ...@@ -646,6 +646,15 @@ class TestSQLCatalog(unittest.TestCase):
order_by_expression = sql_expression.getOrderByExpression() order_by_expression = sql_expression.getOrderByExpression()
self.assertTrue('MATCH' in order_by_expression, (order_by_expression, direction)) self.assertTrue('MATCH' in order_by_expression, (order_by_expression, direction))
def test_logicalOperators(self):
self.catalog(ReferenceQuery(ReferenceQuery(operator='=', default='AN ORB'),
operator='and'),
{'default': 'AN ORB'})
self.catalog(ReferenceQuery(
ReferenceQuery(operator='in', default=['AN', 'ORB']),
operator='and'),
{'default': 'AN OR ORB'})
##return catalog(title=Query(title='a', operator='not')) ##return catalog(title=Query(title='a', operator='not'))
#return catalog(title={'query': 'a', 'operator': 'not'}) #return catalog(title={'query': 'a', 'operator': 'not'})
#return catalog(title={'query': ['a', 'b'], 'operator': 'not'}) #return catalog(title={'query': ['a', 'b'], 'operator': 'not'})
......
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