Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# deepdiff v 3.2.0
# deepdiff v 3.2.1

[![Join the chat at https://gitter.im/deepdiff/Lobby](https://badges.gitter.im/deepdiff/Lobby.svg)](https://gitter.im/deepdiff/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

<!-- ![Downloads](https://img.shields.io/pypi/dm/deepdiff.svg?style=flat) -->
![Python Versions](https://img.shields.io/pypi/pyversions/deepdiff.svg?style=flat)
![Doc](https://readthedocs.org/projects/deepdiff/badge/?version=latest)
Expand Down Expand Up @@ -795,6 +794,7 @@ And here is more info: <http://zepworks.com/blog/diff-it-to-digg-it/>

##Changelog

- v3-2-1: Fixing hash of None
- v3-2-0: Adding grep for search: object | grep(item)
- v3-1-3: Unicode vs. Bytes default fix
- v3-1-2: NotPresent Fix when item is added or removed.
Expand Down
3 changes: 2 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**DeepDiff v 3.2.0**
**DeepDiff v 3.2.1**

Deep Difference of dictionaries, iterables, strings and other objects. It will recursively look for all the changes.

Expand Down Expand Up @@ -240,6 +240,7 @@ http://zepworks.com/blog/diff-it-to-digg-it/

**Changelog**

- v3-2-1: Fixing hash of None
- v3-2-0: Adding grep for search: object | grep(item)
- v3-1-3: Unicode vs. Bytes default fix
- v3-1-2: NotPresent Fix when item is added or removed.
Expand Down
9 changes: 6 additions & 3 deletions deepdiff/contenthash.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ class DeepHash(dict):
**DeepHash**
"""

show_warning = True

def __init__(self,
obj,
hashes=None,
Expand Down Expand Up @@ -76,7 +74,9 @@ def __init__(self,

self.__hash(obj, parents_ids=frozenset({id(obj)}))

if not self['unprocessed']:
if self['unprocessed']:
logger.warning("Can not hash the following items: {}.".format(self['unprocessed']))
else:
del self['unprocessed']

@staticmethod
Expand Down Expand Up @@ -233,6 +233,9 @@ def __hash(self, obj, parent="root", parents_ids=frozenset({})):
if self.__skip_this(obj):
result = self.skipped

elif obj is None:
result = 'NONE'

elif isinstance(obj, strings):
result = self.__hash_str(obj)

Expand Down
4 changes: 1 addition & 3 deletions deepdiff/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,6 @@ class DeepDiff(ResultDict):

"""

show_warning = True

def __init__(self,
t1,
t2,
Expand Down Expand Up @@ -901,7 +899,7 @@ def __diff_str(self, level):
"""Compare strings"""
if level.t1 == level.t2:
return

# do we add a diff for convenience?
do_diff = True
if isinstance(level.t1, bytes_type):
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
# built documents.
#
# The short X.Y version.
version = '3.2.0'
version = '3.2.1'
# The full version, including alpha/beta/rc tags.
release = '3.2.0'
release = '3.2.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

DeepDiff 3.2.0 documentation!
DeepDiff 3.2.1 documentation!
=============================

**DeepDiff: Deep Difference of dictionaries, iterables and almost any other object recursively.**
Expand Down Expand Up @@ -346,6 +346,7 @@ Indices and tables
Changelog
=========

- v3-2-1: Fixing hash of None
- v3-2-0: Adding grep for search: object | grep(item)
- v3-1-3: Unicode vs. Bytes default fix
- v3-1-2: NotPresent Fix when item is added or removed.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
long_description = "Deep Difference and Search of any Python object/data."

setup(name='deepdiff',
version='3.2.0',
version='3.2.1',
description='Deep Difference and Search of any Python object/data.',
url='https://github.com/seperman/deepdiff',
download_url='https://github.com/seperman/deepdiff/tarball/master',
Expand Down
21 changes: 14 additions & 7 deletions tests/test_diff_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import datetime
from decimal import Decimal
from deepdiff import DeepDiff
from deepdiff.helper import py3, bytes_type
from deepdiff.helper import py3
from tests import CustomClass
if py3:
from unittest import mock
Expand Down Expand Up @@ -177,7 +177,7 @@ def test_string_difference2(self):
}
}
self.assertEqual(ddiff, result)

def test_bytes(self):
t1 = {
1: 1,
Expand All @@ -189,11 +189,11 @@ def test_bytes(self):
"c": b"\x80",
}
}
t2 = {1: 1,
2: 2,
3: 3,
t2 = {1: 1,
2: 2,
3: 3,
4: {
"a": b"hello",
"a": b"hello",
"b": b"world\n1\n2\nEnd",
"c": b'\x81',
}
Expand All @@ -214,7 +214,7 @@ def test_bytes(self):
}
}
self.assertEqual(ddiff, result)

def test_unicode(self):
t1 = {
1: 1,
Expand Down Expand Up @@ -543,6 +543,13 @@ def test_list_of_sets_difference_ignore_order_when_there_is_duplicate_and_mix_of
result = {'iterable_item_added': {'root[0]': {4}}}
self.assertEqual(ddiff, result)

def test_set_of_none(self):
"""
https://github.com/seperman/deepdiff/issues/64
"""
ddiff = DeepDiff(set(), set([None]))
self.assertEqual(ddiff, {'set_item_added': {'root[None]'}})

def test_list_that_contains_dictionary(self):
t1 = {1: 1, 2: 2, 3: 3, 4: {"a": "hello", "b": [1, 2, {1: 1, 2: 2}]}}
t2 = {1: 1, 2: 2, 3: 3, 4: {"a": "hello", "b": [1, 2, {1: 3}]}}
Expand Down