Skip to content

feat: annotated argpare adding support for frozenset#1691

Open
KelvinChung2000 wants to merge 2 commits into
mainfrom
feat/annotated-frozenset
Open

feat: annotated argpare adding support for frozenset#1691
KelvinChung2000 wants to merge 2 commits into
mainfrom
feat/annotated-frozenset

Conversation

@KelvinChung2000

Copy link
Copy Markdown
Contributor

close #1685

frozenset[T] joins list/set/tuple as a supported collection annotation:
it registers the same single-arg collection resolver, coerces the parsed
values into a frozenset, and rejects nested collections like the others.
Adds a do_tags example and parametrizes the container runtime-cast test
(which now also covers frozenset).
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.59%. Comparing base (6c6d844) to head (cba60f5).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1691      +/-   ##
==========================================
+ Coverage   99.57%   99.59%   +0.01%     
==========================================
  Files          23       23              
  Lines        5678     5678              
==========================================
+ Hits         5654     5655       +1     
+ Misses         24       23       -1     
Flag Coverage Δ
unittests 99.59% <100.00%> (+0.01%) ⬆️

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.

Comment thread cmd2/annotated.py
float: _make_simple_resolver(float),
int: _make_simple_resolver(int),
Literal: _resolve_literal,
frozenset: _make_collection_resolver(frozenset),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While frozenset is functionally fully supported by this addition, the error messages and internal comments throughout the rest of the file were not updated to reflect this. For example, the user-facing error messages around L725 and L1575, and docstrings around L591 and L1291 still only mention list, set, and tuple. Consider updating these string literals across the file so the exceptions accurately list frozenset as a supported collection type.

Also recommend adding an entry to the CHANGELOG.md to help make this improvement discoverable.

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.

with_annotated should support frozenset

2 participants