You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please checkout the F.A.Q page before creating a bug ticket to make sure it is not already addressed.
Describe the bug
==================================================================================== test session starts ====================================================================================
platform freebsd14 -- Python 3.11.9, pytest-8.1.1, pluggy-1.5.0
Using --randomly-seed=3183454742
PyQt5 5.15.10 -- Qt runtime 5.15.14 -- Qt compiled 5.15.14
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /usr/ports/devel/py-deepdiff/work-py311/deepdiff-8.0.1
configfile: pytest.ini
plugins: hypothesis-6.98.18, timeout-2.1.0, enabler-3.1.1, anyio-4.4.0, time-machine-2.11.0, datadir-1.5.0, flake8-1.1.1, isort-4.0.0, rerunfailures-11.1.2, checkdocs-2.13.0, flaky-3.8.1, flakes-4.0.5, cov-5.0.0, mock-3.10.0, forked-1.6.0, randomly-3.12.0, asyncio-0.23.8, xdist-3.6.1, env-0.6.2, aspectlib-2.0.0, qt-4.2.0, benchmark-4.0.0
asyncio: mode=Mode.STRICT
4 workers [930 items]
ss..........................................................................................................................................................................F......... [ 19%]
............F.............................................................................................................F...........................s............................... [ 39%]
..............................................................s..............................................................................................................s.....s. [ 58%]
.......s.....s....................................................................................................................................................................... [ 78%]
..........................................................................................s....................................................................................s..... [ 97%]
.......................
========================================================================================= FAILURES ==========================================================================================
_____________________________________________________________________ TestDeepDiffPretty.test_namedtuple_seriazliation ______________________________________________________________________
[gw3] freebsd14 -- Python 3.11.9 /usr/local/bin/python3.11
self = <tests.test_serialization.TestDeepDiffPretty object at 0x1d07256f2b10>
def test_namedtuple_seriazliation(self):
op_code = Opcode(tag="replace", t1_from_index=0, t1_to_index=1, t2_from_index=10, t2_to_index=20)
serialized = json_dumps(op_code)
expected = '{"tag":"replace","t1_from_index":0,"t1_to_index":1,"t2_from_index":10,"t2_to_index":20,"old_values":null,"new_values":null}'
> assert serialized == expected
E assert '["replace", ..., null, null]' == '{"tag":"repl...values":null}'
E
E - {"tag":"replace","t1_from_index":0,"t1_to_index":1,"t2_from_index":10,"t2_to_index":20,"old_values":null,"new_values":null}
E + ["replace", 0, 1, 10, 20, null, null]
tests/test_serialization.py:361: AssertionError
___________________________________________________________________________ TestDeepDiffPretty.test_reversed_list ___________________________________________________________________________
[gw3] freebsd14 -- Python 3.11.9 /usr/local/bin/python3.11
self = <tests.test_serialization.TestDeepDiffPretty object at 0x1d07256f3110>
def test_reversed_list(self):
items = reversed([1, 2, 3])
serialized = json_dumps(items)
serialized2 = json_dumps(items)
> assert '[3,2,1]' == serialized
E AssertionError: assert '[3,2,1]' == '[3, 2, 1]'
E
E - [3, 2, 1]
E ? - -
E + [3,2,1]
tests/test_serialization.py:369: AssertionError
_________________________________________________________________ TestDeltaCompareFunc.test_list_of_alphabet_and_its_delta __________________________________________________________________
[gw0] freebsd14 -- Python 3.11.9 /usr/local/bin/python3.11
self = <tests.test_delta.TestDeltaCompareFunc object at 0x37510655ded0>
def test_list_of_alphabet_and_its_delta(self):
l1 = "A B C D E F G D H".split()
l2 = "B C X D H Y Z".split()
diff = DeepDiff(l1, l2)
# Problem: The index of values_changed should be either all for AFTER removals or BEFORE removals.
# What we have here is that F & G transformation to Y and Z is not compatible with A and E removal
# it is really meant for the removals to happen first, and then have indexes in L2 for values changing
# rather than indexes in L1. Here what we need to have is:
# A B C D E F G D H
# A B C-X-E
# B C D F G D H # removal
# What we really need is to report is as it is in difflib for delta specifically:
# A B C D E F G D H
# B C D E F G D H delete t1[0:1] --> t2[0:0] ['A'] --> []
# B C D E F G D H equal t1[1:3] --> t2[0:2] ['B', 'C'] --> ['B', 'C']
# B C X D H replace t1[3:7] --> t2[2:3] ['D', 'E', 'F', 'G'] --> ['X']
# B C X D H equal t1[7:9] --> t2[3:5] ['D', 'H'] --> ['D', 'H']
# B C X D H Y Z insert t1[9:9] --> t2[5:7] [] --> ['Y', 'Z']
# So in this case, it needs to also include information about what stays equal in the delta
# NOTE: the problem is that these operations need to be performed in a specific order.
# DeepDiff removes that order and just buckets all insertions vs. replace vs. delete in their own buckets.
# For times that we use Difflib, we may want to keep the information for the array_change key
# just for the sake of delta, but not for reporting in deepdiff itself.
# that way we can re-apply the changes as they were reported in delta.
delta = Delta(diff)
assert l2 == l1 + delta
with pytest.raises(ValueError) as exc_info:
l1 == l2 - delta
assert "Please recreate the delta with bidirectional=True" == str(exc_info.value)
delta2 = Delta(diff, bidirectional=True)
assert l2 == l1 + delta2
assert l1 == l2 - delta2
dump = Delta(diff, bidirectional=True).dumps()
delta3 = Delta(dump, bidirectional=True)
assert l2 == l1 + delta3
assert l1 == l2 - delta3
dump4 = Delta(diff, bidirectional=True, serializer=json_dumps).dumps()
> delta4 = Delta(dump4, bidirectional=True, deserializer=json_loads)
tests/test_delta.py:2431:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
deepdiff/delta.py:130: in __init__
self.diff = _deserializer(diff, safe_to_import=safe_to_import)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = '{"values_changed": {"root[3]": {"new_value": "X", "old_value": "D", "new_path": "root[2]"}, "root[5]": {"new_value": ...3, 7, 2, 3, ["D", "E", "F", "G"], ["X"]], ["equal", 7, 9, 3, 5, null, null], ["insert", 9, 9, 5, 7, [], ["Y", "Z"]]]}}'
safe_to_import = None
def _deserializer(obj, safe_to_import=None):
result = deserializer(obj)
if result.get('_iterable_opcodes'):
_iterable_opcodes = {}
for path, op_codes in result['_iterable_opcodes'].items():
_iterable_opcodes[path] = []
for op_code in op_codes:
_iterable_opcodes[path].append(
> Opcode(
**op_code
)
)
E TypeError: deepdiff.helper.Opcode() argument after ** must be a mapping, not list
deepdiff/delta.py:102: TypeError
-------- coverage: platform freebsd14, python 3.11.9-final-0 ---------
Name Stmts Miss Cover
-------------------------------------------------
conftest.py 56 8 86%
deepdiff/__init__.py 9 1 89%
deepdiff/anyset.py 46 0 100%
deepdiff/base.py 33 0 100%
deepdiff/commands.py 117 3 97%
deepdiff/deephash.py 357 6 98%
deepdiff/delta.py 696 49 93%
deepdiff/diff.py 927 21 98%
deepdiff/distance.py 167 11 93%
deepdiff/helper.py 404 19 95%
deepdiff/lfucache.py 153 6 96%
deepdiff/model.py 433 2 99%
deepdiff/operator.py 28 1 96%
deepdiff/path.py 178 25 86%
deepdiff/search.py 148 0 100%
deepdiff/serialization.py 259 14 95%
tests/__init__.py 45 4 91%
tests/test_anyset.py 33 0 100%
tests/test_cache.py 66 13 80%
tests/test_command.py 84 0 100%
tests/test_delta.py 920 15 98%
tests/test_diff_datetime.py 39 0 100%
tests/test_diff_math.py 80 0 100%
tests/test_diff_numpy.py 12 0 100%
tests/test_diff_other.py 122 0 100%
tests/test_diff_text.py 1054 30 97%
tests/test_diff_tree.py 131 5 96%
tests/test_distance.py 132 0 100%
tests/test_hash.py 644 8 99%
tests/test_helper.py 83 0 100%
tests/test_ignore_order.py 490 32 93%
tests/test_lfucache.py 36 0 100%
tests/test_model.py 141 0 100%
tests/test_operators.py 129 3 98%
tests/test_path.py 27 0 100%
tests/test_search.py 346 2 99%
tests/test_serialization.py 216 1 99%
-------------------------------------------------
TOTAL 8841 279 97%
================================================================================== short test summary info ==================================================================================
FAILED tests/test_serialization.py::TestDeepDiffPretty::test_namedtuple_seriazliation - assert '["replace", ..., null, null]' == '{"tag":"repl...values":null}'
FAILED tests/test_serialization.py::TestDeepDiffPretty::test_reversed_list - AssertionError: assert '[3,2,1]' == '[3, 2, 1]'
FAILED tests/test_delta.py::TestDeltaCompareFunc::test_list_of_alphabet_and_its_delta - TypeError: deepdiff.helper.Opcode() argument after ** must be a mapping, not list
======================================================================== 3 failed, 917 passed, 10 skipped in 29.64s =========================================================================
*** Error code 1
To Reproduce
pytest
OS, DeepDiff version and Python version (please complete the following information):
OS: FreeBSD 14.1
Python Version 3.11
DeepDiff Version 8.0.1
The text was updated successfully, but these errors were encountered:
Please checkout the F.A.Q page before creating a bug ticket to make sure it is not already addressed.
Describe the bug
To Reproduce
pytest
OS, DeepDiff version and Python version (please complete the following information):
The text was updated successfully, but these errors were encountered: