Fixes issue where the key deep_distance is not returned when both compared items are equal #510
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, Sep. I use your library for some evals code and I realized DeepDiff doesn't send back the key "deep_distance" when comparing exact matches. I read the docs and there is no explicit mention that it shouldn't. I expect a deep_distance=0 returned at least when I ask for it using get_deep_distance=True.
I had some checks in my code on top of this. But then I wanted to make sure and when down debugging your code.
I found two issues.
One is if deep_distance is 0, remove_empty_keys treats it as empty. I added a very simple check. If the item is an instance of int, then it should have some value. Thus it's not empty.
Second, the
__len__
function only expects to deal with SetOrdered instances so I just added an int there.I hope this fits with your design goals. Let me know if I misunderstood the docs. Otherwise, feel free to make edits as you please before merging.