Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ examples/.ipynb_checkpoints
# Node
node_modules
package-lock.json

# worktrees
worktrees
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ default_install_hook_types:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.0
rev: v0.15.19
hooks:
- id: ruff
args: ["--fix", "--exit-non-zero-on-fix"]
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -21,18 +21,18 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.18.0
rev: v9.26.0
hooks:
- id: commitlint
stages:
- commit-msg
additional_dependencies: ['conventional-changelog-conventionalcommits']
- repo: https://github.com/pycqa/isort
rev: 5.13.2
rev: 9.0.0a3
hooks:
- id: isort
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.2
hooks:
- id: codespell
args: ["-x", ".codespellignorelines"]
Expand All @@ -42,12 +42,12 @@ repos:
- id: pydocstyle
additional_dependencies: ["tomli"]
- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
rev: 7.3.0
hooks:
- id: flake8
additional_dependencies: ['flake8-pyproject']
- repo: https://github.com/arkinmodi/add-license-header
rev: v2.2.0
rev: v2.4.1
hooks:
- id: add-license-header
args:
Expand Down
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ The previous code will output the following dictionary:
{
'file_1.c': (
'The files \'reference_dir/file_1.c\' and \'compared_dir/file_1.c\' are different:\n'
'Added the value(s) \'{"2": 0}\' in the \'[b]\' key.\n'
'Changed the value of \'[a]\' from 1 to 2.\n'
'Changed the value of \'[b][0]\' from 1 to 10.'
'Added value at [\'b\'][2]: 0.\n'
'Changed value at [\'a\']: 1 -> 2.\n'
'Changed value at [\'b\'][0]: 1 -> 10.'
)
}
```
Expand All @@ -136,9 +136,9 @@ Which will output the following ``AssertionError``:

```bash
AssertionError: The files 'reference_dir/file_1.c' and 'compared_dir/file_1.c' are different:
Added the value(s) '{"2": 0}' in the '[b]' key.
Changed the value of '[a]' from 1 to 2.
Changed the value of '[b][0]' from 1 to 10.
Added value at ['b'][2]: 0.
Changed value at ['a']: 1 -> 2.
Changed value at ['b'][0]: 1 -> 10.
```

#### Advanced Configuration Options
Expand Down Expand Up @@ -169,6 +169,21 @@ dir_content_diff.assert_equal_trees(
)
```

Dictionary-based comparators such as JSON, YAML, XML and INI use keyword arguments for
their comparison options. The project-specific `tolerance` and `absolute_tolerance`
arguments control numeric comparisons. Useful DeepDiff options can also be passed as
keywords, for example `exclude_paths`, `exclude_regex_paths`, `include_paths`,
`ignore_order`, `ignore_string_case` and `max_diffs`.

```python
specific_args = {
"sub_dir_1/sub_file_1.a": {
"exclude_paths": {"root['metadata']['timestamp']"},
"ignore_order": True,
}
}
```

Each comparator has different arguments that are detailed in the documentation.

##### File-specific Comparators
Expand Down
Loading
Loading