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 — DeepDiff not excluding paths when ignore_order is True · Issue #174 · qlustered/deepdiff

DeepDiff not excluding paths when ignore_order is True #174

New issue
Copy link
New issue
Copy link
Closed
Closed
DeepDiff not excluding paths when ignore_order is True#174
Copy link
Assignees
seperman
Labels
bug

Description

@bbushnell95
bbushnell95
opened on Feb 5, 2020
Issue body actions

Describe the bug
When attempting to do a diff between two lists of dictionaries, if ignore_order is defined as True, and exclude_paths is provided, the exclude_paths appears to not be accounted for.

To Reproduce
Steps to reproduce the behavior:

  1. Here is the following code snippet I have been using to reproduce the error:
from deepdiff import DeepDiff

obj1 = {'a': 1, 'b': 'randomString', 'e': "1111"}
obj2 = {'c': 1, 'd': 'randomString', 'e': 'Cool'}

obj1a = {'a': 1, 'b': 'randomString', 'e': "2222"}
obj2a = {'c': 1, 'd': 'randomString', 'e': 'Cool'}

test1 = [obj1, obj2]
test2 = [obj2a, obj1a]

exclude_paths = ["root[0]['e']", "root[1]['e']"]

print(DeepDiff(test1, test2, ignore_order=True, report_repetition=True, verbose_level=2, exclude_paths=exclude_paths))
  1. Run the above script
  2. Result will show be:
{'iterable_item_added': {'root[1]': {'a': 1, 'b': 'AaPedDefault', 'e': '2222'}}, 'iterable_item_removed': {'root[0]': {'a': 1, 'b': 'AaPedDefault', 'e': '1111'}}}
  1. If you change the e field of obj1a to be the same as obj1['e'], DeepDiff will return an empty object, as expected.

Expected behavior
Output of the above should show no diff, as e should be excluded from the paths.

Expected output:

{}

OS, DeepDiff version and Python version (please complete the following information):

  • OS: CentOs7
  • DeepDiff Version: 4.2.0
  • Python Version: Python 3.6.5

Activity

  1. benediktbrandt commented on Feb 17, 2020

    @benediktbrandt
    benediktbrandt
    on Feb 17, 2020
    More actions

    We are seeing the same issue with DeepDiff 4.0.9

  2. daaain commented on Mar 3, 2020

    @daaain
    daaain
    on Mar 3, 2020
    More actions

    Just ran into this, still happening with 4.2.0

  3. seperman commented on Mar 10, 2020

    @seperman
    seperman
    on Mar 10, 2020
    Member
    More actions

    Hi @bbushnell95
    Thanks for reporting the issue.
    Let me take a look at it.

    Reacted by Daniel Demmel and Brett Bushnell
  4. seperman
    added
    bug
    on Mar 10, 2020
  5. seperman
    self-assigned this
    on Mar 10, 2020
  6. seperman
    added a commit that references this issue on Mar 11, 2020

    Fixing the issue with exclude_path and hash calculations when diction…

    eb3973a
  7. seperman commented on Mar 11, 2020

    @seperman
    seperman
    on Mar 11, 2020
    Member
    More actions

    This issue is resolved. v4.3.1 is released.
    The exclude_path in your example needs the list index in it though.

    An example can be found in the tests: https://github.com/seperman/deepdiff/blob/master/tests/test_diff_text.py#L1612

    The underlying issue was in DeepHash and is fixed in this commit: eb3973a

    Closing this ticket!

    Reacted by Daniel Demmel
    Reacted by Brett Bushnell
  8. seperman
    closed this as completedon Mar 11, 2020
  9. netbsd-srcmastr
    added a commit that references this issue on May 13, 2020

    py-deepdiff: updated to 4.3.2

    3da6ff5
  10. msk
    added a commit that references this issue on May 11, 2026

    py-deepdiff: updated to 4.3.2

    af7787c
  11. jperkin
    added a commit that references this issue on May 14, 2026

    py-deepdiff: updated to 4.3.2

    1dc7aea
  12. tsutsui
    added a commit that references this issue on Oct 17, 2026

    py-deepdiff: updated to 4.3.2

    36a6475
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @seperman
    seperman

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — 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.