Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.5 #111

Merged
merged 30 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
43467af
Merge pull request #83 from networktocode/main
chadell Sep 1, 2022
e9676bc
Update readme to start with use cases (#84)
itdependsnetworks Sep 22, 2022
0510ebb
Doc update (#87)
itdependsnetworks Sep 23, 2022
7d47d7c
Fix operator checks to follow other check_type logic. (#85)
pszulczewski Sep 23, 2022
afa094d
Implement `ge` and `le` operator type (#89)
lvrfrc87 Sep 27, 2022
21428e8
Fix parameter_match check, to support non-normalized data (#90)
pszulczewski Nov 15, 2022
4a423a7
Update mypy
Apr 11, 2023
c759c33
Bugfix to data normalization
pszulczewski Apr 13, 2023
d30d359
Merge pull request #96 from networktocode/bugfix
pszulczewski Apr 18, 2023
05faf70
Fix ref_key parsing
pszulczewski Apr 18, 2023
b969d0f
Update docs
pszulczewski Apr 18, 2023
e8280c7
Merge pull request #97 from networktocode/fix_ref_key
pszulczewski Apr 19, 2023
b1af665
Issue 92 (#98)
pszulczewski Apr 20, 2023
3f52fd2
Bump certifi from 2022.9.24 to 2022.12.7 (#95)
dependabot[bot] Apr 20, 2023
b5b1daf
Merge branch 'main' into develop
lvrfrc87 Apr 20, 2023
4c981c3
Update version and changelog
lvrfrc87 Apr 20, 2023
7fbefb1
update poetry lock
lvrfrc87 Apr 20, 2023
2ef92b1
Update changelog
lvrfrc87 Apr 20, 2023
f18a9c3
Issue 94 & 91 (#100)
pszulczewski Apr 20, 2023
e09a2ab
Relax deepdiff dependency.
Kircheneer May 12, 2023
b11f4cd
Update pyproject.toml
Kircheneer May 12, 2023
a1ff40c
Update poetry.lock
Kircheneer May 12, 2023
82ba480
Merge pull request #101 from Kircheneer/lk-relax-deepdiff-dependency
pszulczewski May 12, 2023
9081e12
Relase v0.0.4
pszulczewski May 12, 2023
a2844f1
Merge pull request #103 from networktocode/release-0.0.4
pszulczewski May 12, 2023
3b1b3c1
Release v0.0.4 (#105)
pszulczewski May 12, 2023
1540227
Merge branch 'test-main' into develop
pszulczewski May 12, 2023
c3761d9
Bump up jamespath, remove py3.7 (#110)
pszulczewski Nov 17, 2023
e73c03f
Merge remote-tracking branch 'origin/main' into release-0.5
pszulczewski Nov 17, 2023
38e441e
Release 0.5
pszulczewski Nov 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading