Skip to content

Removing more than two items from a list #178

@the-bird-is-the-word

Description

@the-bird-is-the-word

Package version (if known): 0.9.0

Describe the bug

There seems to be an error when more than two items are deleted from a list:

import dictdiffer

before = [{"idx": 1}, {"idx": 2}, {"idx": 3}, {"idx": 4}]
after = [{"idx": 1}]

dd = dictdiffer.diff(before, after)
print(dictdiffer.revert(dd, after))

prints

[{'idx': 1}, {'idx': 2}, {'idx': 4}, {'idx': 3}]

Steps to Reproduce

Try the code above.

Expected behavior

It should print

[{'idx': 1}, {'idx': 2}, {'idx': 3}, {'idx': 4}]

Additional context

It seems to occur only if more than 2 items are deleted - for 1 or 2 deleted items everything works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions