Hello community,
here is the log from the commit of package python-deepdiff for openSUSE:Factory
checked in at 2020-04-02 17:44:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-deepdiff (Old)
and /work/SRC/openSUSE:Factory/.python-deepdiff.new.3248 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-deepdiff"
Thu Apr 2 17:44:56 2020 rev:4 rq:790855 version:4.3.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-deepdiff/python-deepdiff.changes
2020-03-10 09:51:34.888030455 +0100
+++
/work/SRC/openSUSE:Factory/.python-deepdiff.new.3248/python-deepdiff.changes
2020-04-02 17:45:19.153526728 +0200
@@ -1,0 +2,8 @@
+Thu Apr 2 10:36:40 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- update to 4.3.2
+ * Deprecation Warning Enhancement
+ * DeepDiff not excluding paths when ignore_order is True
+ * adding exclude_obj_callback
+
+-------------------------------------------------------------------
Old:
----
4.2.0.tar.gz
New:
----
4.3.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-deepdiff.spec ++++++
--- /var/tmp/diff_new_pack.ZWpZiZ/_old 2020-04-02 17:45:19.793527501 +0200
+++ /var/tmp/diff_new_pack.ZWpZiZ/_new 2020-04-02 17:45:19.797527506 +0200
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-deepdiff
-Version: 4.2.0
+Version: 4.3.2
Release: 0
Summary: Deep Difference and Search of any Python object/data
License: MIT
++++++ 4.2.0.tar.gz -> 4.3.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/deepdiff-4.2.0/AUTHORS new/deepdiff-4.3.2/AUTHORS
--- old/deepdiff-4.2.0/AUTHORS 2020-01-30 22:32:11.000000000 +0100
+++ new/deepdiff-4.3.2/AUTHORS 2020-03-19 02:55:43.000000000 +0100
@@ -1,7 +1,8 @@
-Many thanks to the following people for their contributions to DeepDiff:
-
- Seperman
- Victor Hahn Castell @ Flexoptix
+
+And many thanks to the following people for their contributions to DeepDiff:
+
- nfvs for Travis-CI setup script.
- brbsix for initial Py3 porting.
- WangFenjin for Unicode support.
@@ -24,3 +25,4 @@
- Necrophagos for Hashing of the number 1 vs. True
- Hugo (hugovk) for fixes for Python 3.10 and dropping support for EOL Python
3.4
- Andrey Gavrilin (gaal-dev) for hashing classes.
+- Ivan Piskunov (van-ess0) for deprecation warning enhancement.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/deepdiff-4.2.0/README.md new/deepdiff-4.3.2/README.md
--- old/deepdiff-4.2.0/README.md 2020-01-30 22:32:11.000000000 +0100
+++ new/deepdiff-4.3.2/README.md 2020-03-19 02:55:43.000000000 +0100
@@ -1,4 +1,4 @@
-# DeepDiff v 4.2.0
+# DeepDiff v 4.3.2
<!--  -->

@@ -417,6 +417,9 @@
# ChangeLog
+- v4-3-2: Deprecation Warning Enhancement
+- v4-3-1: Fixing the issue with exclude_path and hash calculations when
dictionaries were inside iterables.
https://github.com/seperman/deepdiff/issues/174
+- v4-3-0: adding exclude_obj_callback
- v4-2-0: .json property is finally removed. Fix for Py3.10. Dropping support
for EOL Python 3.4. Ignoring private keys when calculating hashes. For example
__init__ is not a part of hash calculation anymore. Fix for #166 Problem with
comparing lists, with an boolean as element.
- v4-0-9: Fixing the bug for hashing custom unhashable objects
- v4-0-8: Adding ignore_nan_inequality for float('nan')
@@ -507,3 +510,5 @@
- Juan Soler (Soleronline) for adding ignore_type_number
- mthaddon for adding timedelta diffing support
- Necrophagos for Hashing of the number 1 vs. True
+- gaal-dev for adding exclude_obj_callback
+- Ivan Piskunov (van-ess0) for deprecation warning enhancement.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/deepdiff-4.2.0/deepdiff/__init__.py
new/deepdiff-4.3.2/deepdiff/__init__.py
--- old/deepdiff-4.2.0/deepdiff/__init__.py 2020-01-30 22:32:11.000000000
+0100
+++ new/deepdiff-4.3.2/deepdiff/__init__.py 2020-03-19 02:55:43.000000000
+0100
@@ -1,6 +1,6 @@
"""This module offers the DeepDiff, DeepSearch, grep and DeepHash classes."""
# flake8: noqa
-__version__ = '4.2.0'
+__version__ = '4.3.2'
import logging
if __name__ == '__main__':
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/deepdiff-4.2.0/deepdiff/deephash.py
new/deepdiff-4.3.2/deepdiff/deephash.py
--- old/deepdiff-4.2.0/deepdiff/deephash.py 2020-01-30 22:32:11.000000000
+0100
+++ new/deepdiff-4.3.2/deepdiff/deephash.py 2020-03-19 02:55:43.000000000
+0100
@@ -68,7 +68,9 @@
ignore_numeric_type_changes=False,
ignore_type_subclasses=False,
ignore_string_case=False,
+ exclude_obj_callback=None,
number_to_string_func=None,
+ parent="root",
**kwargs):
if kwargs:
raise ValueError(
@@ -77,7 +79,7 @@
"exclude_paths, exclude_regex_paths, hasher,
ignore_repetition, "
"number_format_notation, apply_hash, ignore_type_in_groups,
ignore_string_type_changes, "
"ignore_numeric_type_changes, ignore_type_subclasses,
ignore_string_case "
- "number_to_string_func") % ', '.join(kwargs.keys()))
+ "number_to_string_func, parent") % ', '.join(kwargs.keys()))
self.obj = obj
exclude_types = set() if exclude_types is None else set(exclude_types)
self.exclude_types_tuple = tuple(exclude_types) # we need tuple for
checking isinstance
@@ -100,6 +102,7 @@
self.ignore_string_type_changes = ignore_string_type_changes
self.ignore_numeric_type_changes = ignore_numeric_type_changes
self.ignore_string_case = ignore_string_case
+ self.exclude_obj_callback = exclude_obj_callback
# makes the hash return constant size result if true
# the only time it should be set to False is when
# testing the individual hash functions for different types of objects.
@@ -107,7 +110,7 @@
self.type_check_func = type_is_subclass_of_type_group if
ignore_type_subclasses else type_in_type_group
self.number_to_string = number_to_string_func or number_to_string
- self._hash(obj, parent="root", parents_ids=frozenset({get_id(obj)}))
+ self._hash(obj, parent=parent, parents_ids=frozenset({get_id(obj)}))
if self[UNPROCESSED]:
logger.warning("Can not hash the following items:
{}.".format(self[UNPROCESSED]))
@@ -196,10 +199,10 @@
elif self.exclude_regex_paths and any(
[exclude_regex_path.search(parent) for exclude_regex_path in
self.exclude_regex_paths]):
skip = True
- else:
- if self.exclude_types_tuple and isinstance(obj,
self.exclude_types_tuple):
- skip = True
-
+ elif self.exclude_types_tuple and isinstance(obj,
self.exclude_types_tuple):
+ skip = True
+ elif self.exclude_obj_callback and self.exclude_obj_callback(obj,
parent):
+ skip = True
return skip
def _prep_dict(self, obj, parent, parents_ids=EMPTY_FROZENSET,
print_as_attribute=False, original_type=None):
@@ -215,6 +218,8 @@
key_in_report = key_text % (parent, key_formatted)
key_hash = self._hash(key, parent=key_in_report,
parents_ids=parents_ids)
+ if not key_hash:
+ continue
item_id = get_id(item)
if (parents_ids and item_id in parents_ids) or
self._skip_this(item, parent=key_in_report):
continue
@@ -241,7 +246,8 @@
result = defaultdict(int)
for i, item in enumerate(obj):
- if self._skip_this(item, parent="{}[{}]".format(parent, i)):
+ new_parent = "{}[{}]".format(parent, i)
+ if self._skip_this(item, parent=new_parent):
continue
item_id = get_id(item)
@@ -249,7 +255,7 @@
continue
parents_ids_added = add_to_frozen_set(parents_ids, item_id)
- hashed = self._hash(item, parent=parent,
parents_ids=parents_ids_added)
+ hashed = self._hash(item, parent=new_parent,
parents_ids=parents_ids_added)
# counting repetitions
result[hashed] += 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/deepdiff-4.2.0/deepdiff/deephash_doc.rst
new/deepdiff-4.3.2/deepdiff/deephash_doc.rst
--- old/deepdiff-4.2.0/deepdiff/deephash_doc.rst 2020-01-30
22:32:11.000000000 +0100
+++ new/deepdiff-4.3.2/deepdiff/deephash_doc.rst 2020-03-19
02:55:43.000000000 +0100
@@ -34,6 +34,11 @@
exclude_regex_paths: list, default = None
List of string regex paths or compiled regex paths objects to exclude from
the report. If only one item, you can path it as a string instead of a list
containing only one regex path.
+exclude_obj_callback
+ function, default = None
+ A function that takes the object and its path and returns a Boolean. If
True is returned, the object is excluded from the results, otherwise it is
included.
+ This is to give the user a higher level of control than one can achieve
via exclude_paths, exclude_regex_paths or other means.
+
hasher: function. default = DeepHash.murmur3_128bit
hasher is the hashing function. The default is DeepHash.murmur3_128bit.
But you can pass another hash function to it if you want.
@@ -286,6 +291,22 @@
>>> DeepHash('hello', ignore_string_case=True)['hello'] ==
DeepHash('heLLO', ignore_string_case=True)['heLLO']
True
+exclude_obj_callback
+ function, default = None
+ A function that takes the object and its path and returns a Boolean. If
True is returned, the object is excluded from the results, otherwise it is
included.
+ This is to give the user a higher level of control than one can achieve
via exclude_paths, exclude_regex_paths or other means.
+
+ >>> dic1 = {"x": 1, "y": 2, "z": 3}
+ >>> t1 = [dic1]
+ >>> t1_hash = DeepHash(t1, exclude_obj_callback=exclude_obj_callback)
+ >>>
+ >>> dic2 = {"z": 3}
+ >>> t2 = [dic2]
+ >>> t2_hash = DeepHash(t2, exclude_obj_callback=exclude_obj_callback)
+ >>>
+ >>> t1_hash[t1] == t2_hash[t2]
+ True
+
number_format_notation : string, default="f"
When numbers are converted to the string, you have the choices between "f"
as fixed point and "e" as scientific notation:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/deepdiff-4.2.0/deepdiff/diff.py
new/deepdiff-4.3.2/deepdiff/diff.py
--- old/deepdiff-4.2.0/deepdiff/diff.py 2020-01-30 22:32:11.000000000 +0100
+++ new/deepdiff-4.3.2/deepdiff/diff.py 2020-03-19 02:55:43.000000000 +0100
@@ -9,7 +9,6 @@
import difflib
import logging
import json
-import warnings
from itertools import zip_longest
from collections.abc import Mapping, Iterable
@@ -29,7 +28,6 @@
from deepdiff.base import Base
logger = logging.getLogger(__name__)
-warnings.simplefilter('once', DeprecationWarning)
try:
import jsonpickle
@@ -63,6 +61,7 @@
ignore_numeric_type_changes=False,
ignore_type_subclasses=False,
ignore_string_case=False,
+ exclude_obj_callback=None,
number_to_string_func=None,
ignore_nan_inequality=False,
verbose_level=1,
@@ -93,6 +92,7 @@
self.ignore_type_subclasses = ignore_type_subclasses
self.type_check_func = type_is_subclass_of_type_group if
ignore_type_subclasses else type_in_type_group
self.ignore_string_case = ignore_string_case
+ self.exclude_obj_callback = exclude_obj_callback
self.number_to_string = number_to_string_func or number_to_string
self.ignore_nan_inequality = ignore_nan_inequality
self.hashes = {}
@@ -224,10 +224,12 @@
elif self.exclude_regex_paths and any(
[exclude_regex_path.search(level.path()) for
exclude_regex_path in self.exclude_regex_paths]):
skip = True
- else:
- if self.exclude_types_tuple and (isinstance(level.t1,
self.exclude_types_tuple) or
- isinstance(level.t2,
self.exclude_types_tuple)):
- skip = True
+ elif self.exclude_types_tuple and \
+ (isinstance(level.t1, self.exclude_types_tuple) or
isinstance(level.t2, self.exclude_types_tuple)):
+ skip = True
+ elif self.exclude_obj_callback and \
+ (self.exclude_obj_callback(level.t1, level.path()) or
self.exclude_obj_callback(level.t2, level.path())):
+ skip = True
return skip
@@ -465,6 +467,7 @@
hashes = {}
for (i, item) in enumerate(t):
try:
+ parent = "{}[{}]".format(level.path(), i)
hashes_all = DeepHash(item,
hashes=self.hashes,
exclude_types=self.exclude_types,
@@ -480,8 +483,10 @@
ignore_type_subclasses=self.ignore_type_subclasses,
ignore_string_case=self.ignore_string_case,
number_to_string_func=self.number_to_string,
+
exclude_obj_callback=self.exclude_obj_callback,
+ parent=parent,
+ apply_hash=False,
)
- # import pytest; pytest.set_trace()
key = item
if item is True:
key = BoolObj.TRUE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/deepdiff-4.2.0/deepdiff/diff_doc.rst
new/deepdiff-4.3.2/deepdiff/diff_doc.rst
--- old/deepdiff-4.2.0/deepdiff/diff_doc.rst 2020-01-30 22:32:11.000000000
+0100
+++ new/deepdiff-4.3.2/deepdiff/diff_doc.rst 2020-03-19 02:55:43.000000000
+0100
@@ -71,6 +71,10 @@
exclude_types: list, default = None
List of object types to exclude from the report.
+exclude_obj_callback: function, default = None
+ A function that takes the object and its path and returns a Boolean. If
True is returned, the object is excluded from the results, otherwise it is
included.
+ This is to give the user a higher level of control than one can achieve
via exclude_paths, exclude_regex_paths or other means.
+
ignore_string_type_changes: Boolean, default = False
Whether to ignore string type changes or not. For example b"Hello" vs.
"Hello" are considered the same if ignore_string_type_changes is set to True.
@@ -497,6 +501,20 @@
>>> DeepDiff(float('nan'), float('nan'), ignore_nan_inequality=True)
{}
+
+exclude_obj_callback
+ function, default = None
+ A function that takes the object and its path and returns a Boolean. If
True is returned, the object is excluded from the results, otherwise it is
included.
+ This is to give the user a higher level of control than one can achieve
via exclude_paths, exclude_regex_paths or other means.
+
+ >>> def exclude_obj_callback(obj, path):
+ ... return True if "skip" in path or isinstance(obj, int) else False
+ ...
+ >>> t1 = {"x": 10, "y": "b", "z": "c", "skip_1": 0}
+ >>> t2 = {"x": 12, "y": "b", "z": "c", "skip_2": 0}
+ >>> DeepDiff(t1, t2, exclude_obj_callback=exclude_obj_callback)
+ {}
+
**Tree View**
Starting the version 3 You can chooe the view into the deepdiff results.
@@ -806,7 +824,7 @@
.. seealso::
Take a look at to_json() documentation in this page for more details.
-If you want the original DeepDiff object to be serialized with all the bells
and whistles, you can use the to_json_pickle() and to_json_pickle() in order to
serialize and deserialize its results into json. Note that json_pickle is
unsafe and json pickle dumps from untrusted sources should never be loaded.
+If you want the original DeepDiff object to be serialized with all the bells
and whistles, you can use the to_json_pickle() and from_json_pickle() in order
to serialize and deserialize its results into json. Note that json_pickle is
unsafe and json pickle dumps from untrusted sources should never be loaded.
Serialize and then deserialize back to deepdiff
>>> t1 = {1: 1, 2: 2, 3: 3}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/deepdiff-4.2.0/deepdiff/helper.py
new/deepdiff-4.3.2/deepdiff/helper.py
--- old/deepdiff-4.2.0/deepdiff/helper.py 2020-01-30 22:32:11.000000000
+0100
+++ new/deepdiff-4.3.2/deepdiff/helper.py 2020-03-19 02:55:43.000000000
+0100
@@ -3,6 +3,7 @@
import re
import os
import logging
+import warnings
from decimal import Decimal, localcontext
from collections import namedtuple
from ordered_set import OrderedSet
@@ -243,3 +244,13 @@
if number_format_notation == 'e' and isinstance(number, float):
result = result.replace('+0', '+')
return result
+
+
+class DeepDiffDeprecationWarning(DeprecationWarning):
+ """
+ Use this warning instead of DeprecationWarning
+ """
+ pass
+
+
+warnings.simplefilter('once', DeepDiffDeprecationWarning)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/deepdiff-4.2.0/docs/conf.py
new/deepdiff-4.3.2/docs/conf.py
--- old/deepdiff-4.2.0/docs/conf.py 2020-01-30 22:32:11.000000000 +0100
+++ new/deepdiff-4.3.2/docs/conf.py 2020-03-19 02:55:43.000000000 +0100
@@ -59,9 +59,9 @@
# built documents.
#
# The short X.Y version.
-version = '4.2.0'
+version = '4.3.2'
# The full version, including alpha/beta/rc tags.
-release = '4.2.0'
+release = '4.3.2'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/deepdiff-4.2.0/docs/index.rst
new/deepdiff-4.3.2/docs/index.rst
--- old/deepdiff-4.2.0/docs/index.rst 2020-01-30 22:32:11.000000000 +0100
+++ new/deepdiff-4.3.2/docs/index.rst 2020-03-19 02:55:43.000000000 +0100
@@ -4,7 +4,7 @@
contain the root `toctree` directive.
-DeepDiff 4.2.0 documentation!
+DeepDiff 4.3.2 documentation!
=============================
**DeepDiff: Deep Difference of dictionaries, iterables, strings and other
objects. It will recursively look for all the changes.**
@@ -281,6 +281,9 @@
Changelog
=========
+- v4-3-2: Deprecation Warning Enhancement
+- v4-3-1: Fixing the issue with exclude_path and hash calculations when
dictionaries were inside iterables.
https://github.com/seperman/deepdiff/issues/174
+- v4-3-0: adding exclude_obj_callback
- v4-2-0: .json property is finally removed. Fix for Py3.10. Dropping support
for EOL Python 3.4. Ignoring private keys when calculating hashes. For example
__init__ is not a part of hash calculation anymore. Fix for #166 Problem with
comparing lists, with an boolean as element.
- v4-1-0: .json property is finally removed.
- v4-0-9: Fixing the bug for hashing custom unhashable objects
@@ -340,9 +343,11 @@
- `hahncastell.de <http://hahncastell.de>`_
- `flexoptix.net <http://www.flexoptix.net>`_
+And thanks to the following people for their great contributions!
+
- nfvs for Travis-CI setup script.
- brbsix for initial Py3 porting.
-- WangFenjin for unicode support.
+- WangFenjin for Unicode support.
- timoilya for comparing list of sets when ignoring order.
- Bernhard10 for significant digits comparison.
- b-jazz for PEP257 cleanup, Standardize on full names, fixing line endings.
@@ -359,4 +364,8 @@
- Brian Maissy (brianmaissy) for fixing classes which inherit from classes
with slots didn't have all of their slots compared
- Juan Soler (Soleronline) for adding ignore_type_number
- mthaddon for adding timedelta diffing support
-
+- Necrophagos for Hashing of the number 1 vs. True
+- Hugo (hugovk) for fixes for Python 3.10 and dropping support for EOL Python
3.4
+- Andrey Gavrilin (gaal-dev) for hashing classes.
+- gaal-dev for adding exclude_obj_callback
+- Ivan Piskunov (van-ess0) for deprecation warning enhancement.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/deepdiff-4.2.0/setup.cfg new/deepdiff-4.3.2/setup.cfg
--- old/deepdiff-4.2.0/setup.cfg 2020-01-30 22:32:11.000000000 +0100
+++ new/deepdiff-4.3.2/setup.cfg 2020-03-19 02:55:43.000000000 +0100
@@ -1,5 +1,5 @@
[bumpversion]
-current_version = 4.2.0
+current_version = 4.3.2
commit = True
tag = True
tag_name = {new_version}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/deepdiff-4.2.0/setup.py new/deepdiff-4.3.2/setup.py
--- old/deepdiff-4.2.0/setup.py 2020-01-30 22:32:11.000000000 +0100
+++ new/deepdiff-4.3.2/setup.py 2020-03-19 02:55:43.000000000 +0100
@@ -10,7 +10,7 @@
if os.environ.get('USER', '') == 'vagrant':
del os.link
-version = '4.2.0'
+version = '4.3.2'
def get_reqs(filename):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/deepdiff-4.2.0/tests/test_diff_text.py
new/deepdiff-4.3.2/tests/test_diff_text.py
--- old/deepdiff-4.2.0/tests/test_diff_text.py 2020-01-30 22:32:11.000000000
+0100
+++ new/deepdiff-4.3.2/tests/test_diff_text.py 2020-03-19 02:55:43.000000000
+0100
@@ -1609,6 +1609,17 @@
assert 'dictionary_item_added' in ddiff, {}
assert 'dictionary_item_removed' not in ddiff, {}
+ def test_skip_exclude_path5(self):
+ exclude_paths = ["root[0]['e']", "root[1]['e']"]
+
+ t1 = [{'a': 1, 'b': 'randomString', 'e': "1111"}]
+ t2 = [{'a': 1, 'b': 'randomString', 'e': "2222"}]
+
+ ddiff = DeepDiff(t1, t2, exclude_paths=exclude_paths,
+ ignore_order=True, report_repetition=False)
+ result = {}
+ assert result == ddiff
+
def test_skip_custom_object_path(self):
t1 = CustomClass(1)
t2 = CustomClass(2)
@@ -1647,6 +1658,16 @@
result = {}
assert result == ddiff
+ def test_skip_exclude_obj_callback(self):
+ def exclude_obj_callback(obj, path):
+ return True if "skip" in path or isinstance(obj, int) else False
+
+ t1 = {"x": 10, "y": "b", "z": "c", "skip_1": 0}
+ t2 = {"x": 12, "y": "b", "z": "c", "skip_2": 0}
+ ddiff = DeepDiff(t1, t2, exclude_obj_callback=exclude_obj_callback)
+ result = {}
+ assert result == ddiff
+
def test_skip_str_type_in_dictionary(self):
t1 = {1: {2: "a"}}
t2 = {1: {}}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/deepdiff-4.2.0/tests/test_hash.py
new/deepdiff-4.3.2/tests/test_hash.py
--- old/deepdiff-4.2.0/tests/test_hash.py 2020-01-30 22:32:11.000000000
+0100
+++ new/deepdiff-4.3.2/tests/test_hash.py 2020-03-19 02:55:43.000000000
+0100
@@ -510,6 +510,23 @@
assert 2 in t1_hash
assert t1_hash[2] == t2_hash[2]
+ def test_skip_path2(self):
+
+ obj10 = {'a': 1, 'b': 'f', 'e': "1111", 'foo': {'bar': 'baz'}}
+ obj11 = {'c': 1, 'd': 'f', 'e': 'Cool'}
+
+ obj20 = {'a': 1, 'b': 'f', 'e': 'Cool', 'foo': {'bar': 'baz2'}}
+ obj21 = {'c': 1, 'd': 'f', 'e': "2222"}
+
+ t1 = [obj10, obj11]
+ t2 = [obj20, obj21]
+
+ exclude_paths = ["root[0]['e']", "root[1]['e']",
"root[0]['foo']['bar']"]
+
+ t1_hash = DeepHashPrep(t1, exclude_paths=exclude_paths)
+ t2_hash = DeepHashPrep(t2, exclude_paths=exclude_paths)
+ assert t1_hash[t1] == t2_hash[t2]
+
def test_skip_regex_path(self):
dic1 = {1: "a"}
t1 = [dic1, 2]
@@ -520,6 +537,20 @@
assert 2 in t1_hash
assert t1_hash[2] == t2_hash[2]
+ def test_skip_hash_exclude_obj_callback(self):
+ def exclude_obj_callback(obj, parent):
+ return True if parent == "root[0]['x']" or obj == 2 else False
+
+ dic1 = {"x": 1, "y": 2, "z": 3}
+ t1 = [dic1]
+ t1_hash = DeepHashPrep(t1, exclude_obj_callback=exclude_obj_callback)
+ assert t1_hash == {'y': 'str:y', 'z': 'str:z', 3: 'int:3',
+ get_id(dic1): 'dict:{str:z:int:3}', get_id(t1):
'list:dict:{str:z:int:3}'}
+ dic2 = {"z": 3}
+ t2 = [dic2]
+ t2_hash = DeepHashPrep(t2, exclude_obj_callback=exclude_obj_callback)
+ assert t1_hash[t1] == t2_hash[t2]
+
def test_string_case(self):
t1 = "Hello"