GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — updating changelog · sreecodeslayer/deepdiff@6e5a87f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • README.md
  • README.txt
  • deepdiff
    • deepdiff.py
  • docs
    • index.rst
  • tests.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+10Lines changed: 10 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,15 @@ Approximate float comparison:
281281
{'values_changed': {'root': {'new_value': 1.24e+20, 'old_value': 1.23e+20}}}
282282
```
283283

284+
### Using DeepDiff in unit tests
285+
286+
`result` is the output of the function that is being tests.
287+
`expected` is the expected output of the function.
288+
289+
```python
290+
assertEqual(DeepDiff(result, expected), {})
291+
```
292+
284293
## Difference with Json Patch
285294

286295
Unlike [Json Patch](https://tools.ietf.org/html/rfc6902) which is designed only for Json objects, DeepDiff is designed specifically for almost all Python types. In addition to that, DeepDiff checks for type changes and attribute value changes that Json Patch does not cover since there are no such things in Json. Last but not least, DeepDiff gives you the exact path of the item(s) that were changed in Python syntax.
@@ -305,6 +314,7 @@ Example in DeepDiff for the same operation:
305314

306315
##Changelog
307316

317+
- v1-6-0: Unifying key names. i.e newvalue is new_value now. For backward compatibility, newvalue still works.
308318
- v1-5-0: Fixing ignore order containers with unordered items. Adding significant digits when comparing decimals. Changes property is deprecated.
309319
- v1-1-0: Changing Set, Dictionary and Object Attribute Add/Removal to be reported as Set instead of List. Adding Pypy compatibility.
310320
- v1-0-2: Checking for ImmutableMapping type instead of dict
Collapse file

‎README.txt‎

Copy file name to clipboardExpand all lines: README.txt
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,14 @@ Object attribute added:
185185
'values_changed': {'root.b': {'new_value': 2, 'old_value': 1}}}
186186

187187

188+
Using DeepDiff in unit tests
189+
result is the output of the function that is being tests.
190+
expected is the expected output of the function.
191+
>>> assertEqual(DeepDiff(result, expected), {})
192+
193+
194+
195+
188196
**Difference with Json Patch**
189197

190198
Unlike Json Patch https://tools.ietf.org/html/rfc6902 which is designed only for Json objects, DeepDiff is designed specifically for almost all Python types. In addition to that, DeepDiff checks for type changes and attribute value changes that Json Patch does not cover since there are no such things in Json. Last but not least, DeepDiff gives you the exact path of the item(s) that were changed in Python syntax.
@@ -201,6 +209,7 @@ Example in DeepDiff for the same operation:
201209

202210
**Changelog**
203211

212+
- v1-6-0: Unifying key names. i.e newvalue is new_value now. For backward compatibility, newvalue still works.
204213
- v1-5-0: Fixing ignore order containers with unordered items. Adding significant digits when comparing decimals. Changes property is deprecated.
205214
- v1-1-0: Changing Set, Dictionary and Object Attribute Add/Removal to be reported as Set instead of List. Adding Pypy compatibility.
206215
- v1-0-2: Checking for ImmutableMapping type instead of dict
Collapse file

‎deepdiff/deepdiff.py‎

Copy file name to clipboardExpand all lines: deepdiff/deepdiff.py
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import sys
66
import difflib
77
import datetime
8+
import logging
89
try:
910
import cPickle as pickle
1011
except:
@@ -34,6 +35,9 @@
3435
from itertools import izip_longest as zip_longest
3536
items = 'iteritems'
3637

38+
logging.basicConfig(format='%(asctime)s %(levelname)8s %(message)s')
39+
logger = logging.getLogger()
40+
3741
IndexedHash = namedtuple('IndexedHash', 'indexes item')
3842

3943
EXPANDED_KEY_MAP = {
@@ -85,9 +89,14 @@ class RemapDict(dict):
8589
For keys that have a new, longer name, remap the old key to the new key.
8690
Other keys that don't have a new name are handled as before.
8791
"""
92+
show_warning = True
8893

8994
def __getitem__(self, old_key):
9095
new_key = EXPANDED_KEY_MAP.get(old_key, old_key)
96+
if self.show_warning and new_key != old_key:
97+
self.show_warning = False
98+
logger.warning("DeepDiff Deprecation: %s is renamed to %s. Please start using\
99+
the new unified naming convention.", old_key, new_key)
91100
if new_key in self:
92101
return self.get(new_key)
93102
else:
@@ -337,6 +346,8 @@ class DeepDiff(RemapDict):
337346
{'values_changed': {'root': {'new_value': 1.24e+20, 'old_value': 1.23e+20}}}
338347
"""
339348

349+
show_warning = True
350+
340351
def __init__(self, t1, t2, ignore_order=False, report_repetition=False, significant_digits=None, **kwargs):
341352
if kwargs:
342353
raise ValueError("The following parameter(s) are not valid: %s\nThe valid parameters are ignore_order, report_repetition and significant_digits" % ', '.join(kwargs.keys()))
Collapse file

‎docs/index.rst‎

Copy file name to clipboardExpand all lines: docs/index.rst
+1Lines changed: 1 addition & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Indices and tables
4444
Changelog
4545
=========
4646

47+
- v1-6-0: Unifying key names. i.e newvalue is new_value now. For backward compatibility, newvalue still works.
4748
- v1-5-0: Fixing ignore order containers with unordered items. Adding significant digits when comparing decimals. Changes property is deprecated.
4849
- v1-1-0: Changing Set, Dictionary and Object Attribute Add/Removal to be reported as Set instead of List. Adding Pypy compatibility.
4950
- v1-0-2: Checking for ImmutableMapping type instead of dict
Collapse file

‎tests.py‎

Copy file name to clipboardExpand all lines: tests.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from decimal import Decimal
1313
from deepdiff import DeepDiff
1414
from sys import version
15+
import logging
16+
logging.disable(logging.CRITICAL)
1517

1618
py3 = version[0] == '3'
1719

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.