Repository navigation
test(api): add unit tests for libs.collection_utils - #46041
Merged
asukaminato0721 merged 1 commit intoNov 11, 2026
Merged
asukaminato0721 merged 1 commit into
asukaminato0721 merged 1 commit into
Conversation
Covers convert_to_lower_and_upper_set with 21 cases: empty-collection short-circuit, the `if s` guard that skips empty strings, case-variant deduplication, various Collection types (list/tuple/set/frozenset/deque), non-mutation of the input, Unicode upper expansion and punctuation. Purely additive: one new test file, 0 deletions.
Contributor
Pyrefly Type Coverage
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #46041 +/- ##
=======================================
Coverage 90.13% 90.13%
=======================================
Files 6305 6305
Lines 394692 394692
Branches 79178 79178
=======================================
+ Hits 355766 355767 +1
- Misses 32815 32816 +1
+ Partials 6111 6109 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
asukaminato0721
approved these changes
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds unit tests for the previously uncovered
libs.collection_utils.convert_to_lower_and_upper_set.The helper builds case-insensitive lookup sets and has several non-obvious behaviours that are easy to break: falsy collections short-circuit to an empty set, the
if sguard silently skips empty strings, and results are deduplicated across case variants. The 21 cases pin those behaviours plus support for anyCollection[str], non-mutation of the input, Unicode upper expansion (Straße->STRASSE) and punctuation/whitespace handling.Purely additive: one new test file, 0 deletions, no production code touched.
Verification
Local, Python 3.13, with this repo's
[tool.pyrefly]andapi/.ruff.toml:pyrefly 1.5.0-dev.1 check(the version proposed in ci: bump tyck to check new err #45614): 0 diagnosticspytest: 21 passedruff check+ruff format --check: cleanlibs...., noapi.prefix)# type: ignoreused; parametrized values are typedCollection[str]main, LF line endingsAI-assisted test generation; assertions reflect the documented behaviour of the helper.