Repository navigation
Don't exclude a statement because of ... inside a string - #2329
Open
Kayvan-Zahiri wants to merge 1 commit into
Open
Kayvan-Zahiri wants to merge 1 commit into
Kayvan-Zahiri wants to merge 1 commit into
Conversation
The default ellipsis exclusion treated a line of three dots inside a multi-line string as a stub body and dropped the whole assignment. Co-authored-by: Cursor <[email protected]>
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.
Summary
Fixes #2112.
The default
...exclusion is meant to drop a line that is only an ellipsis, and a function whose body is only.... It also matched a line of three dots inside a multi-line string. A YAML literal that ends with...was then excluded as a whole, so the assignment never showed up in the report.Exclusion matches that sit entirely inside a string literal (including f-string and t-string text) are now ignored. A real
...statement and a stub such asdef stub(): ...are still excluded.Test plan
tests/test_coverage.py::ExcludeTest::test_ellipsis_inside_string_is_not_excludedfailed before the change: the YAML, f-string, and bytes assignments were missing from the measured lines ([6, 11, 15, 17]instead of[1, 6, 8, 11, 12, 15, 17]).ExcludeTestandtests/test_parser.py: 104 passed, 1 skipped.Made with Cursor