Skip to content

Commit

Permalink
Merge pull request #510 from sherjeelshabih/dev
Browse files Browse the repository at this point in the history
Fixes issue where the key deep_distance is not returned when both compared items are equal
  • Loading branch information
seperman authored Dec 14, 2024
2 parents 514e025 + 324aad3 commit 743c901
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions deepdiff/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def remove_empty_keys(self):
Remove empty keys from this object. Should always be called after the result is final.
:return:
"""
empty_keys = [k for k, v in self.items() if not v]
empty_keys = [k for k, v in self.items() if not isinstance(v, (int)) and not v]

for k in empty_keys:
del self[k]
Expand Down Expand Up @@ -88,7 +88,7 @@ def __getitem__(self, item):
return self.get(item)

def __len__(self):
return sum([len(i) for i in self.values() if isinstance(i, SetOrdered)])
return sum([len(i) for i in self.values() if isinstance(i, SetOrdered)]) + len([i for i in self.values() if isinstance(i, int)])


class TextResult(ResultDict):
Expand Down

0 comments on commit 743c901

Please sign in to comment.