Skip to content

Fix show_most_common_types for empty results - #87

Open
moruku36 wants to merge 1 commit into
mgedmin:masterfrom
moruku36:fix/show-most-common-types-empty
Open

moruku36 wants to merge 1 commit into
mgedmin:masterfrom
moruku36:fix/show-most-common-types-empty

Conversation

@moruku36

Copy link
Copy Markdown

Summary

Fix show_most_common_types() raising ValueError: max() arg is an empty sequence when no objects remain to display, including an explicit empty object list or a filter that rejects all supplied objects.

Use max(..., default=0) so empty results produce no output while preserving existing nonempty formatting. Add two regression tests and an unreleased changelog entry.

Verification

  • Independently executed python3 tests.py ShowMostCommonTypesTest.test_empty_objects ShowMostCommonTypesTest.test_filter_rejects_all: 2 tests passed.
  • git diff --check: clean.
  • The default test suite collects the new test class.
  • Full suite, coverage, lint, other Python versions, and Windows have not been run locally.

Implementation assisted by Claude Sonnet 5.5; actual diff independently reviewed.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants