Skip to content

Commit

Permalink
Merge pull request #20 from 15five/g17-logexp-order
Browse files Browse the repository at this point in the history
Fix LogExp Ordering Issue
  • Loading branch information
logston committed Oct 31, 2020
2 parents 08de23c + 642ab3f commit 399fa73
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/scim2_filter_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ class SCIMParser(Parser):
# which takes precedence over "or"
# 3. Attribute operators
precedence = (
('nonassoc', OR), # noqa F821
('nonassoc', AND), # noqa F821
('nonassoc', NOT), # noqa F821
('left', OR, AND), # noqa F821
('right', NOT), # noqa F821
)

# FILTER = attrExp / logExp / valuePath / *1"not" "(" FILTER ")"
Expand Down
18 changes: 18 additions & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,24 @@ def test_no_quotes_around_comp_value(self):
with self.assertRaises(parser.SCIMParserError):
self.parser.parse(token_stream)

def test_g17_1_log_exp_order(self):
query = 'displayName co "username" or nickName co "username" or userName co "username"'

tokens = self.lexer.tokenize(query)
self.parser.parse(tokens) # Should not raise error

def test_g17_2_log_exp_order(self):
query = 'displayName co "username" and nickName co "username" and userName co "username"'

tokens = self.lexer.tokenize(query)
self.parser.parse(tokens) # Should not raise error

def test_g17_3_log_exp_order(self):
query = 'displayName co "username" and nickName co "username" or userName co "username"'

tokens = self.lexer.tokenize(query)
self.parser.parse(tokens) # Should not raise error


class CommandLine(TestCase):
def setUp(self):
Expand Down

0 comments on commit 399fa73

Please sign in to comment.