Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #684 +/- ##
==========================================
- Coverage 69.27% 69.23% -0.05%
==========================================
Files 50 50
Lines 3339 3341 +2
Branches 386 387 +1
==========================================
Hits 2313 2313
- Misses 932 933 +1
- Partials 94 95 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
Fixes #541.
Problem
Condition.eachandCondition.for_eachwere typed to returnCondition[Iterable[E]]. BecauseConditionis invariant in its genericparameter, PyCharm's type checker couldn't resolve
Condition[Iterable[Element]]against theCondition[Collection]boundexpected by a collection entity's
.should()— even thoughCollectionis itself an
Iterable[Element]at runtime. This produced a false-positivetype mismatch warning in PyCharm for code like:
Fix
Changed both return type annotations (
for_eachand theeachproperty)from
Condition[Iterable[E]]toCondition[Collection], matching what.should()actually expects on collection entities.Collectionisimported under
TYPE_CHECKINGto avoid a circular import withentity.py.Verification
mypy selene/core/condition.py— no issuesreveal_type()thatCondition[Element].eachnowresolves to
Condition[Collection](previouslyCondition[Iterable[Element]])pytest tests/unit— all 62 tests passblack --check— cleanI don't have PyCharm available to visually confirm the IDE warning
disappears, but the mypy
reveal_typeoutput confirms the underlyingtype resolution now matches what
.should()expects. Would appreciatea maintainer with PyCharm doing a final visual check on
ss('').should(have.text('').each).