Skip to content

Commit af07aa7

Browse files
authored
Release 0.5 (#111)
* Bump up jamespath, remove py3.7 (#110) * Release 0.5 --------- Signed-off-by: dependabot[bot] <[email protected]>
1 parent 4a887ff commit af07aa7

9 files changed

+442
-649
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
strategy:
8989
fail-fast: true
9090
matrix:
91-
python-version: ["3.7"]
91+
python-version: ["3.8"]
9292
env:
9393
PYTHON_VER: "${{ matrix.python-version }}"
9494
INVOKE_LOCAL: "True"
@@ -105,7 +105,7 @@ jobs:
105105
strategy:
106106
fail-fast: true
107107
matrix:
108-
python-version: ["3.7", "3.8", "3.9", "3.10"]
108+
python-version: ["3.8", "3.9", "3.10", "3.11"]
109109
runs-on: "ubuntu-20.04"
110110
env:
111111
PYTHON_VER: "${{ matrix.python-version }}"

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v0.0.5
4+
- Update jmespath dependency
5+
- Drop python 3.7 support
6+
37
## v0.0.4
48
- Relax deepdiff dependency
59

jdiff/utils/diff_helpers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def get_diff_iterables_items(diff_result: Mapping) -> DefaultDict:
2323
"""
2424
get_dict_keys = re.compile(r"^root((\['\w.*'\])+)\[\d+\]$")
2525

26-
defaultdict_list = partial(defaultdict, list)
26+
defaultdict_list = partial(defaultdict, list) # type: partial
2727
result = defaultdict(defaultdict_list) # type: DefaultDict
2828

2929
items_removed = diff_result.get("iterable_item_removed")

poetry.lock

+423-634
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "jdiff"
3-
version = "0.0.4"
3+
version = "0.0.5"
44
description = "A light-weight library to compare structured output from network devices show commands."
55
authors = ["Network to Code, LLC <[email protected]>"]
66
license = "Apache-2.0"
@@ -22,9 +22,9 @@ include = [
2222
]
2323

2424
[tool.poetry.dependencies]
25-
python = "^3.7.0"
25+
python = "^3.8"
2626
deepdiff = ">=5.5.0 <7.0"
27-
jmespath = "^0.10.0"
27+
jmespath = "^1.0.1"
2828

2929
[tool.poetry.dev-dependencies]
3030
pytest = "*"
@@ -77,7 +77,6 @@ no-docstring-rgx="^(_|test_|Meta$)"
7777
# protected-access disabled as we want test the method
7878
disable = """,
7979
line-too-long,
80-
bad-continuation,
8180
too-many-branches,
8281
protected-access
8382
"""

tasks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def is_truthy(arg):
3030
TOOL_CONFIG = PYPROJECT_CONFIG["tool"]["poetry"]
3131

3232
# Can be set to a separate Python version to be used for launching or building image
33-
PYTHON_VER = os.getenv("PYTHON_VER", "3.7")
33+
PYTHON_VER = os.getenv("PYTHON_VER", "3.8")
3434
# Name of the docker image/image
3535
IMAGE_NAME = os.getenv("IMAGE_NAME", TOOL_CONFIG["name"])
3636
# Tag for the image

tests/test_diff_helpers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
def test_dict_merger():
66
"""Tests that dict is merged as expected and duplicates identified."""
7-
original_dict = dict(key_1="my_key_1", key_5="my_key_5")
8-
dict_to_merge = dict(key_1="my_key_1", key_2="my_key_2", key_3="my_key_3")
7+
original_dict = {"key_1": "my_key_1", "key_5": "my_key_5"}
8+
dict_to_merge = {"key_1": "my_key_1", "key_2": "my_key_2", "key_3": "my_key_3"}
99
dict_merger(original_dict, dict_to_merge)
1010

1111
assert original_dict == {

tests/test_get_value.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_jmspath_return_none(jmspath):
1717
with pytest.raises(TypeError) as error:
1818
extract_data_from_json(data=data, path=jmspath)
1919

20-
assert "JMSPath returned 'None'. Please, verify your JMSPath regex." in error.value.__str__()
20+
assert "JMSPath returned 'None'. Please, verify your JMSPath regex." in str(error.value)
2121

2222

2323
test_cases_extract_data_no_ref_key = [

tests/test_type_checks.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ class CheckTypeChild(CheckType):
2121
with pytest.raises(TypeError) as error:
2222
CheckTypeChild() # pylint: disable=E0110
2323

24-
assert (
25-
"Can't instantiate abstract class CheckTypeChild"
26-
" with abstract methods _validate, evaluate" in error.value.__str__()
24+
assert "Can't instantiate abstract class CheckTypeChild" " with abstract methods _validate, evaluate" in str(
25+
error.value
2726
)
2827

2928

@@ -69,7 +68,7 @@ def tests_exceptions_init(check_type_str, exception_type, expected_in_output):
6968
"""Tests exceptions when check object is initialized."""
7069
with pytest.raises(exception_type) as error:
7170
CheckType.create(check_type_str)
72-
assert expected_in_output in error.value.__str__()
71+
assert expected_in_output in str(error.value)
7372

7473

7574
exact_match_test_values_no_change = (
@@ -303,6 +302,7 @@ def test_param_match(filename, check_type_str, evaluate_args, path, expected_res
303302
# There is not concept of "pre" and "post" in parameter_match.
304303
data = load_json_file("parameter_match", filename)
305304
value = extract_data_from_json(data, path)
305+
# pylint:disable=too-many-function-args
306306
actual_results = check.evaluate(evaluate_args["params"], value, evaluate_args["mode"])
307307
assert actual_results == expected_result, ASSERT_FAIL_MESSAGE.format(
308308
output=actual_results, expected_output=expected_result
@@ -350,6 +350,7 @@ def test_regex_match(filename, check_type_str, evaluate_args, path, expected_res
350350
# There is not concept of "pre" and "post" in parameter_match.
351351
data = load_json_file("api", filename)
352352
value = extract_data_from_json(data, path)
353+
# pylint:disable=too-many-function-args
353354
actual_results = check.evaluate(evaluate_args["regex"], value, evaluate_args["mode"])
354355
assert actual_results == expected_result, ASSERT_FAIL_MESSAGE.format(
355356
output=actual_results, expected_output=expected_result

0 commit comments

Comments
 (0)