inveniosoftware / inveniosoftware/dictdiffer

Removing more than two items from a list

Open
#178 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
849
Forks
99
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.