Skip to content

tests: add unit tests for dict_filter - #11072

Closed
eeshsaxena wants to merge 1 commit into
treeverse:mainfrom
eeshsaxena:test/dict-filter
Closed

tests: add unit tests for dict_filter#11072
eeshsaxena wants to merge 1 commit into
treeverse:mainfrom
eeshsaxena:test/dict-filter

Conversation

@eeshsaxena

Copy link
Copy Markdown
Contributor

Description

dvc.utils.dict_filter recursively drops a set of keys from a nested
dict/list structure (it backs dict_hash), but had no direct test coverage.

This adds tests/unit/utils/test_dict_filter.py covering:

  • flat exclusion and multiple excluded keys
  • nested keys being removed recursively
  • an excluded key removing its whole subtree
  • a list of dicts being filtered element-wise
  • an empty exclude returning the input unchanged
  • a scalar being passed through untouched

No source changes.

Verification

pytest tests/unit/utils/test_dict_filter.py - 7 passed. ruff check /
ruff format --check clean.

@github-project-automation github-project-automation Bot moved this to Backlog in DVC Jul 17, 2026
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.98%. Comparing base (2431ec6) to head (c581f31).
⚠️ Report is 211 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11072      +/-   ##
==========================================
+ Coverage   90.68%   90.98%   +0.30%     
==========================================
  Files         504      506       +2     
  Lines       39795    41154    +1359     
  Branches     3141     3263     +122     
==========================================
+ Hits        36087    37444    +1357     
- Misses       3042     3071      +29     
+ Partials      666      639      -27     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@eeshsaxena

Copy link
Copy Markdown
Contributor Author

Hi! Gentle ping on this one; it's been open a couple of weeks and CI is green. Happy to rebase or make any changes if something's needed; whenever you get a chance to take a look, I'd really appreciate it. Thanks!

@skshetry

skshetry commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the patch, but I'd rather not add tests for such a simple utility. It has not been changed for a long time and is indirectly covered through dict_md5/dict_sha256 tests. Adding them now does not seem to add value. Sorry.

@skshetry skshetry closed this Aug 6, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in DVC Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants