Skip to content

[models] Invert an empty list or dict in invert_data_structure - #2211

Merged
felixdittrich92 merged 1 commit into
mindee:mainfrom
RavSinghChandan:invert-data-structure-empty
Oct 31, 2026
Merged

felixdittrich92 merged 1 commit into
mindee:mainfrom
RavSinghChandan:invert-data-structure-empty

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

invert_data_structure([]) raised IndexError (it reads the keys from x[0]), and invert_data_structure({}) raised
"All the lists in the dictionary should have the same length." although there are no lists at all. An empty
list now gives an empty dict and an empty dict an empty list. Lists of different lengths still raise.
Tests added to test_convert_list_dict; they fail on main.

@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.78%. Comparing base (b31580a) to head (29c2fc1).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2211   +/-   ##
=======================================
  Coverage   97.78%   97.78%           
=======================================
  Files         170      170           
  Lines       10986    10986           
=======================================
  Hits        10743    10743           
  Misses        243      243           
Flag Coverage Δ
unittests 97.78% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@felixdittrich92 felixdittrich92 self-assigned this Oct 31, 2026
@felixdittrich92 felixdittrich92 added this to the 1.2.0 milestone Oct 31, 2026
@felixdittrich92 felixdittrich92 added type: enhancement Improvement module: models Related to doctr.models ext: tests Related to tests folder labels Oct 31, 2026

@felixdittrich92 felixdittrich92 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍🏼

@felixdittrich92
felixdittrich92 merged commit b690ba9 into mindee:main Oct 31, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext: tests Related to tests folder module: models Related to doctr.models type: enhancement Improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants