Skip to content

Commit 77312b6

Browse files
authored
Fix #17 Add Python 3.7 Testing (#18)
* Fix #17 Add Python 3.7 Testing This adds Python 3.7 testing. Signed-off-by: David Brown <dmlb2000@gmail.com> * Fix #17 Add Python 3.7 Testing This adds Python 3.7 testing. Signed-off-by: David Brown <dmlb2000@gmail.com> * Fix Pylint 2.x Issues Signed-off-by: David Brown <dmlb2000@gmail.com>
1 parent 96c7686 commit 77312b6

File tree

8 files changed

+19
-17
lines changed

8 files changed

+19
-17
lines changed

.travis.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1+
dist: xenial
12
language: python
2-
python: 3.6
33
stages:
44
- lint
55
- test
66
- deploy
77

8+
".test_script": &1
9+
- coverage run --include='jsonpath2/*' --omit='jsonpath2/parser/JSONPath*' -m pytest -v
10+
- coverage report -m --fail-under 100
11+
- pip install .
12+
- python setup.py bdist_wheel
13+
- python setup.py sdist
14+
815
install: pip install -r requirements-dev.txt
916
jobs:
1017
include:
1118
- stage: lint
1219
python: 3.6
1320
script: pre-commit run -a
21+
- python: 3.7
22+
script: pre-commit run -a
1423
- stage: test
1524
python: 3.6
16-
script:
17-
- coverage run --include='jsonpath2/*' --omit='jsonpath2/parser/JSONPath*' -m pytest -v
18-
- coverage report -m --fail-under 100
19-
- pip install .
20-
- python setup.py bdist_wheel
21-
- python setup.py sdist
25+
script: *1
26+
- python: 3.7
27+
script: *1
2228
- stage: deploy
23-
python: 3.6
29+
python: 3.7
2430
script: skip
2531
deploy:
2632
skip_cleanup: true

jsonpath2/expressions/operator.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ class OperatorExpression(Expression):
1212

1313
def __jsonpath__(self) -> Generator[str, None, None]: # pragma: no cover abstract method
1414
"""Abstract method to return the jsonpath."""
15-
pass
1615

1716
def evaluate(self, root_value: object, current_value: object) -> bool: # pragma: no cover abstract method
1817
"""Abstract method to evaluate the expression."""
19-
pass
2018

2119

2220
class BinaryOperatorExpression(OperatorExpression):

jsonpath2/node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
# pylint: disable=too-few-public-methods
10-
class MatchData(object):
10+
class MatchData:
1111
"""Match data object for storing node values."""
1212

1313
def __init__(self, node, root_value, current_value):

jsonpath2/path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import jsonpath2.parser as _parser
88

99

10-
class Path(object):
10+
class Path:
1111
"""Path parsetree object."""
1212

1313
def __init__(self, root_node: RootNode):

jsonpath2/subscript.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ class Subscript(Node):
1010

1111
def __jsonpath__(self) -> Generator[str, None, None]: # pragma: no cover abstract method
1212
"""Abstract method to return the jsonpath."""
13-
pass
1413

1514
def match(
1615
self,
1716
root_value: object,
1817
current_value: object) -> Generator[MatchData, None, None]: # pragma: no cover abstract method.
1918
"""Abstract method to determine a node match."""
20-
pass

jsonpath2/subscripts/arrayindex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def match(self, root_value: object, current_value: object) -> Generator[MatchDat
2727
if self.index < 0:
2828
new_index = self.index + len(current_value)
2929

30-
if (new_index >= 0) and (new_index < len(current_value)):
30+
if 0 <= new_index < len(current_value):
3131
return [MatchData(SubscriptNode(TerminalNode(), [self]), root_value, current_value[new_index])]
3232
elif self.index < len(current_value):
3333
return [MatchData(SubscriptNode(TerminalNode(), [self]), root_value, current_value[self.index])]

jsonpath2/subscripts/wildcard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def match(self, root_value: object, current_value: object) -> Generator[MatchDat
2323
lambda index: ObjectIndexSubscript(
2424
index).match(root_value, current_value),
2525
current_value.keys()))
26-
elif isinstance(current_value, list):
26+
if isinstance(current_value, list):
2727
return itertools.chain(*map(
2828
lambda index: ArrayIndexSubscript(
2929
index).match(root_value, current_value),

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ antlr4-python3-runtime
22
coverage
33
pep257
44
pre-commit
5-
pylint<2.0
5+
pylint
66
pytest
77
setuptools
88
six

0 commit comments

Comments
 (0)