summaryrefslogtreecommitdiff
path: root/examples/searchparser.py
diff options
context:
space:
mode:
authorHugo <hugovk@users.noreply.github.com>2018-08-21 15:40:38 +0300
committerHugo <hugovk@users.noreply.github.com>2018-08-21 15:40:38 +0300
commitc3dba1ed5f9be226044c7ffaf1cd47adcc7482f4 (patch)
tree2c0c45c153434d0c6b78c0d5e51448933f959fb8 /examples/searchparser.py
parent444859662f1829f2d8068fb33cdc375427bf9b6c (diff)
downloadpyparsing-git-c3dba1ed5f9be226044c7ffaf1cd47adcc7482f4.tar.gz
Upgrade Python syntax with pyupgrade
Diffstat (limited to 'examples/searchparser.py')
-rw-r--r--examples/searchparser.py90
1 files changed, 45 insertions, 45 deletions
diff --git a/examples/searchparser.py b/examples/searchparser.py
index e5b40a7..36e3cd7 100644
--- a/examples/searchparser.py
+++ b/examples/searchparser.py
@@ -184,40 +184,40 @@ class ParserTest(SearchQueryParser):
tests containts a dictionary with tests and expected results.
"""
tests = {
- 'help': set([1, 2, 4, 5]),
- 'help or hulp': set([1, 2, 3, 4, 5]),
- 'help and hulp': set([2]),
- 'help hulp': set([2]),
- 'help and hulp or hilp': set([2, 3, 4]),
- 'help or hulp and hilp': set([1, 2, 3, 4, 5]),
- 'help or hulp or hilp or halp': set([1, 2, 3, 4, 5, 6]),
- '(help or hulp) and (hilp or halp)': set([3, 4, 5]),
- 'help and (hilp or halp)': set([4, 5]),
- '(help and (hilp or halp)) or hulp': set([2, 3, 4, 5]),
- 'not help': set([3, 6, 7, 8]),
- 'not hulp and halp': set([5, 6]),
- 'not (help and halp)': set([1, 2, 3, 4, 6, 7, 8]),
- '"help me please"': set([2]),
- '"help me please" or hulp': set([2, 3]),
- '"help me please" or (hulp and halp)': set([2]),
- 'help*': set([1, 2, 4, 5, 8]),
- 'help or hulp*': set([1, 2, 3, 4, 5]),
- 'help* and hulp': set([2]),
- 'help and hulp* or hilp': set([2, 3, 4]),
- 'help* or hulp or hilp or halp': set([1, 2, 3, 4, 5, 6, 8]),
- '(help or hulp*) and (hilp* or halp)': set([3, 4, 5]),
- 'help* and (hilp* or halp*)': set([4, 5]),
- '(help and (hilp* or halp)) or hulp*': set([2, 3, 4, 5]),
- 'not help* and halp': set([6]),
- 'not (help* and helpe*)': set([1, 2, 3, 4, 5, 6, 7]),
- '"help* me please"': set([2]),
- '"help* me* please" or hulp*': set([2, 3]),
- '"help me please*" or (hulp and halp)': set([2]),
- '"help me please" not (hulp and halp)': set([2]),
- '"help me please" hulp': set([2]),
- 'help and hilp and not holp': set([4]),
- 'help hilp not holp': set([4]),
- 'help hilp and not holp': set([4]),
+ 'help': {1, 2, 4, 5},
+ 'help or hulp': {1, 2, 3, 4, 5},
+ 'help and hulp': {2},
+ 'help hulp': {2},
+ 'help and hulp or hilp': {2, 3, 4},
+ 'help or hulp and hilp': {1, 2, 3, 4, 5},
+ 'help or hulp or hilp or halp': {1, 2, 3, 4, 5, 6},
+ '(help or hulp) and (hilp or halp)': {3, 4, 5},
+ 'help and (hilp or halp)': {4, 5},
+ '(help and (hilp or halp)) or hulp': {2, 3, 4, 5},
+ 'not help': {3, 6, 7, 8},
+ 'not hulp and halp': {5, 6},
+ 'not (help and halp)': {1, 2, 3, 4, 6, 7, 8},
+ '"help me please"': {2},
+ '"help me please" or hulp': {2, 3},
+ '"help me please" or (hulp and halp)': {2},
+ 'help*': {1, 2, 4, 5, 8},
+ 'help or hulp*': {1, 2, 3, 4, 5},
+ 'help* and hulp': {2},
+ 'help and hulp* or hilp': {2, 3, 4},
+ 'help* or hulp or hilp or halp': {1, 2, 3, 4, 5, 6, 8},
+ '(help or hulp*) and (hilp* or halp)': {3, 4, 5},
+ 'help* and (hilp* or halp*)': {4, 5},
+ '(help and (hilp* or halp)) or hulp*': {2, 3, 4, 5},
+ 'not help* and halp': {6},
+ 'not (help* and helpe*)': {1, 2, 3, 4, 5, 6, 7},
+ '"help* me please"': {2},
+ '"help* me* please" or hulp*': {2, 3},
+ '"help me please*" or (hulp and halp)': {2},
+ '"help me please" not (hulp and halp)': {2},
+ '"help me please" hulp': {2},
+ 'help and hilp and not holp': {4},
+ 'help hilp not holp': {4},
+ 'help hilp and not holp': {4},
}
docs = {
@@ -232,17 +232,17 @@ class ParserTest(SearchQueryParser):
}
index = {
- 'help': set((1, 2, 4, 5)),
- 'me': set((2,)),
- 'please': set((2,)),
- 'hulp': set((2, 3,)),
- 'hilp': set((3, 4,)),
- 'halp': set((5, 6,)),
- 'thinks': set((5,)),
- 'he': set((5, 6,)),
- 'needs': set((5, 6,)),
- 'nothing': set((7,)),
- 'helper': set((8,)),
+ 'help': {1, 2, 4, 5},
+ 'me': {2},
+ 'please': {2},
+ 'hulp': {2, 3},
+ 'hilp': {3, 4},
+ 'halp': {5, 6},
+ 'thinks': {5},
+ 'he': {5, 6},
+ 'needs': {5, 6},
+ 'nothing': {7},
+ 'helper': {8},
}
def GetWord(self, word):