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

DeepDiff 5.7.0 #287

Merged
merged 12 commits into from
Dec 17, 2021
Merged

DeepDiff 5.7.0 #287

merged 12 commits into from
Dec 17, 2021

Conversation

seperman
Copy link
Owner

@seperman seperman commented Dec 17, 2021

seperman and others added 8 commits October 13, 2021 11:46
For lists comparison when ignore_order is True, TypeError occurs as type(_max) = float it doesnt match with other numbers like Decimal.
The cast should be done when numbers are not 'float' type.
Example: 

```
from decimal import Decimal
from deepdiff import DeepDiff
from deepdiff.helper import number_to_string

def custom_number_to_string(number, *args, **kwargs):
    if type(number) == Decimal:
        number = float(number)
    return number_to_string(number, *args, **kwargs)

def test_deep_diff():
    # a = {'a': [datetime.datetime(2020, 5, 17), datetime.datetime(2020, 6, 17), datetime.datetime(2020, 7, 17)]}
    # b = {'a': [datetime.datetime(2020, 7, 17), datetime.datetime(2020, 6, 17), datetime.datetime(2020, 5, 17)]}
    a = {'a': [Decimal(1), Decimal(2), Decimal(3), Decimal(5)]}
    b = {'a': [Decimal(3), Decimal(2), Decimal(1), Decimal(4)]}
    print(DeepDiff(a, b, ignore_order = True, cutoff_distance_for_pairs=1, number_to_string_func=custom_number_to_string))

def main():
    test_deep_diff()

if __name__ == "__main__":
    main()

```
Bug-Fix: TypeError in _get_numbers_distance()  when ignore_order = True
@codecov-commenter
Copy link

codecov-commenter commented Dec 17, 2021

Codecov Report

Merging #287 (e7a24c8) into master (f3ee1f9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #287   +/-   ##
=======================================
  Coverage   99.55%   99.56%           
=======================================
  Files          14       14           
  Lines        2943     2956   +13     
=======================================
+ Hits         2930     2943   +13     
  Misses         13       13           
Impacted Files Coverage Δ
deepdiff/delta.py 100.00% <100.00%> (ø)
deepdiff/diff.py 100.00% <100.00%> (ø)
deepdiff/distance.py 100.00% <100.00%> (ø)
deepdiff/helper.py 100.00% <100.00%> (ø)
deepdiff/path.py 97.67% <100.00%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f3ee1f9...e7a24c8. Read the comment docs.

@seperman seperman changed the title DeepDiff 5.6.1 DeepDiff 5.7.0 Dec 17, 2021
@seperman seperman merged commit 7e5e995 into master Dec 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants