Skip to content

test(api): add unit tests for libs.collection_utils - #46041

Merged
asukaminato0721 merged 1 commit into
langgenius:mainfrom
TINGyu123644:test/add-collection-utils-tests
Nov 11, 2026
Merged

asukaminato0721 merged 1 commit into
langgenius:mainfrom
TINGyu123644:test/add-collection-utils-tests

Conversation

@TINGyu123644

Copy link
Copy Markdown
Contributor

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 s guard silently skips empty strings, and results are deduplicated across case variants. The 21 cases pin those behaviours plus support for any Collection[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] and api/.ruff.toml:

  • pyrefly 1.5.0-dev.1 check (the version proposed in ci: bump tyck to check new err #45614): 0 diagnostics
  • pytest: 21 passed
  • ruff check + ruff format --check: clean
  • Import follows the existing tests in this directory (libs...., no api. prefix)
  • No # type: ignore used; parametrized values are typed Collection[str]
  • Rebased onto current main, LF line endings

AI-assisted test generation; assertions reflect the documented behaviour of the helper.

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.
@github-actions github-actions Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Nov 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 85.16% 85.16% +0.00%
Strict coverage 84.82% 84.82% +0.00%
Typed symbols 90,128 90,144 +16
Untyped symbols 15,773 15,774 +1
Modules 4470 4471 +1

@codecov

codecov Bot commented Nov 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.13%. Comparing base (edf20ba) to head (c1b0f34).
⚠️ Report is 1 commits behind head on main.

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     
Flag Coverage Δ
api 90.01% <ø> (+<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.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@asukaminato0721
asukaminato0721 added this pull request to the merge queue Nov 11, 2026
Merged via the queue into langgenius:main with commit ecf4d60 Nov 11, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants