Skip to content

Commit

Permalink
Release 0.5 (#111)
Browse files Browse the repository at this point in the history
* Bump up jamespath, remove py3.7 (#110)

* Release 0.5

---------

Signed-off-by: dependabot[bot] <[email protected]>
  • Loading branch information
pszulczewski authored Nov 17, 2023
1 parent 4a887ff commit af07aa7
Show file tree
Hide file tree
Showing 9 changed files with 442 additions and 649 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.7"]
python-version: ["3.8"]
env:
PYTHON_VER: "${{ matrix.python-version }}"
INVOKE_LOCAL: "True"
Expand All @@ -105,7 +105,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
runs-on: "ubuntu-20.04"
env:
PYTHON_VER: "${{ matrix.python-version }}"
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v0.0.5
- Update jmespath dependency
- Drop python 3.7 support

## v0.0.4
- Relax deepdiff dependency

Expand Down
2 changes: 1 addition & 1 deletion jdiff/utils/diff_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_diff_iterables_items(diff_result: Mapping) -> DefaultDict:
"""
get_dict_keys = re.compile(r"^root((\['\w.*'\])+)\[\d+\]$")

defaultdict_list = partial(defaultdict, list)
defaultdict_list = partial(defaultdict, list) # type: partial
result = defaultdict(defaultdict_list) # type: DefaultDict

items_removed = diff_result.get("iterable_item_removed")
Expand Down
1,057 changes: 423 additions & 634 deletions poetry.lock

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "jdiff"
version = "0.0.4"
version = "0.0.5"
description = "A light-weight library to compare structured output from network devices show commands."
authors = ["Network to Code, LLC <[email protected]>"]
license = "Apache-2.0"
Expand All @@ -22,9 +22,9 @@ include = [
]

[tool.poetry.dependencies]
python = "^3.7.0"
python = "^3.8"
deepdiff = ">=5.5.0 <7.0"
jmespath = "^0.10.0"
jmespath = "^1.0.1"

[tool.poetry.dev-dependencies]
pytest = "*"
Expand Down Expand Up @@ -77,7 +77,6 @@ no-docstring-rgx="^(_|test_|Meta$)"
# protected-access disabled as we want test the method
disable = """,
line-too-long,
bad-continuation,
too-many-branches,
protected-access
"""
Expand Down
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def is_truthy(arg):
TOOL_CONFIG = PYPROJECT_CONFIG["tool"]["poetry"]

# Can be set to a separate Python version to be used for launching or building image
PYTHON_VER = os.getenv("PYTHON_VER", "3.7")
PYTHON_VER = os.getenv("PYTHON_VER", "3.8")
# Name of the docker image/image
IMAGE_NAME = os.getenv("IMAGE_NAME", TOOL_CONFIG["name"])
# Tag for the image
Expand Down
4 changes: 2 additions & 2 deletions tests/test_diff_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

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

assert original_dict == {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_get_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_jmspath_return_none(jmspath):
with pytest.raises(TypeError) as error:
extract_data_from_json(data=data, path=jmspath)

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


test_cases_extract_data_no_ref_key = [
Expand Down
9 changes: 5 additions & 4 deletions tests/test_type_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ class CheckTypeChild(CheckType):
with pytest.raises(TypeError) as error:
CheckTypeChild() # pylint: disable=E0110

assert (
"Can't instantiate abstract class CheckTypeChild"
" with abstract methods _validate, evaluate" in error.value.__str__()
assert "Can't instantiate abstract class CheckTypeChild" " with abstract methods _validate, evaluate" in str(
error.value
)


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


exact_match_test_values_no_change = (
Expand Down Expand Up @@ -303,6 +302,7 @@ def test_param_match(filename, check_type_str, evaluate_args, path, expected_res
# There is not concept of "pre" and "post" in parameter_match.
data = load_json_file("parameter_match", filename)
value = extract_data_from_json(data, path)
# pylint:disable=too-many-function-args
actual_results = check.evaluate(evaluate_args["params"], value, evaluate_args["mode"])
assert actual_results == expected_result, ASSERT_FAIL_MESSAGE.format(
output=actual_results, expected_output=expected_result
Expand Down Expand Up @@ -350,6 +350,7 @@ def test_regex_match(filename, check_type_str, evaluate_args, path, expected_res
# There is not concept of "pre" and "post" in parameter_match.
data = load_json_file("api", filename)
value = extract_data_from_json(data, path)
# pylint:disable=too-many-function-args
actual_results = check.evaluate(evaluate_args["regex"], value, evaluate_args["mode"])
assert actual_results == expected_result, ASSERT_FAIL_MESSAGE.format(
output=actual_results, expected_output=expected_result
Expand Down

0 comments on commit af07aa7

Please sign in to comment.