mirror of
https://github.com/ansible/awx.git
synced 2026-01-19 05:31:22 -03:30
remove not operator code instead of commenting
This commit is contained in:
parent
fceb09dc8c
commit
cf26678cea
@ -62,8 +62,6 @@ class TestSmartFilterQueryFromString():
|
||||
('(a=b and c=d)', Q(**{u"a": u"b"}) & Q(**{u"c": u"d"})),
|
||||
('a=b or c=d', Q(**{u"a": u"b"}) | Q(**{u"c": u"d"})),
|
||||
('(a=b and c=d) or (e=f)', (Q(**{u"a": u"b"}) & Q(**{u"c": u"d"})) | (Q(**{u"e": u"f"}))),
|
||||
#('(a=b and not c=d) or not (e=f)', (Q(**{u"a": u"b"}) & ~Q(**{u"c": u"d"})) | (~Q(**{u"e": u"f"}))),
|
||||
#('(a=b) and not (c=d or (e=f and (g=h or i=j))) or (y=z)', Q(**{u"a": u"b"}) & ~(Q(**{u"c": u"d"}) | (Q(**{u"e": u"f"}) & (Q(**{u"g": u"h"}) | Q(**{u"i": u"j"})))) | Q(**{u"y": u"z"})),
|
||||
('a=b or a=d or a=e or a=z and b=h and b=i and b=j and b=k', Q(**{u"a": u"b"}) | Q(**{u"a": u"d"}) | Q(**{u"a": u"e"}) | Q(**{u"a": u"z"}) & Q(**{u"b": u"h"}) & Q(**{u"b": u"i"}) & Q(**{u"b": u"j"}) & Q(**{u"b": u"k"}))
|
||||
])
|
||||
def test_boolean_parenthesis(self, mock_get_host_model, filter_string, q_expected):
|
||||
|
||||
@ -168,16 +168,6 @@ class SmartFilter(object):
|
||||
return left | right
|
||||
|
||||
|
||||
class BoolNot(object):
|
||||
def __init__(self, t):
|
||||
self.right = t[0][1].result
|
||||
|
||||
self.result = self.execute_logic(self.right)
|
||||
|
||||
def execute_logic(self, right):
|
||||
return ~right
|
||||
|
||||
|
||||
@classmethod
|
||||
def query_from_string(cls, filter_string):
|
||||
|
||||
@ -199,7 +189,6 @@ class SmartFilter(object):
|
||||
grammar.setParseAction(cls.BoolOperand)
|
||||
|
||||
boolExpr = infixNotation(grammar, [
|
||||
#("not", 1, opAssoc.RIGHT, cls.BoolNot),
|
||||
("and", 2, opAssoc.LEFT, cls.BoolAnd),
|
||||
("or", 2, opAssoc.LEFT, cls.BoolOr),
|
||||
])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user