`--update-data` introduces new blank lines when aligning multi-line expected info comments
Open
Nobody has claimed this yet.
bug
topic-developer
topic-tests
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Bug Report
After using --update-data in https://github.com/python/mypy/pull/19904/, I'm seeing a lot of diffs like this:
[case testErrorCodeIgnoreMultiple1]
a = 'x'.foobar(b) # type: ignore[name-defined, attr-defined]
a = 'x'.foobar(b) # type: ignore[name-defined, xyz] # E: "str" has no attribute "foobar" [attr-defined] \
- # N: Error code "attr-defined" not covered by "type: ignore" comment
+ # N: Error code "attr-defined" not covered by "type: ignore" comment ignoring [name-defined, xyz]
a = 'x'.foobar(b) # type: ignore[xyz, w, attr-defined] # E: Name "b" is not defined [name-defined] \
- # N: Error code "name-defined" not covered by "type: ignore" comment
+ # N: Error code "name-defined" not covered by "type: ignore" comment ignoring [xyz, w, attr-defined]
+
+
it seems to apply extra whitespace at the end of the test case if it realigns a line continuation
Semi-related to https://github.com/python/mypy/issues/17465, but only a little, I think.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the --update-data entry point and the testErrorCodeIgnoreMultiple1 fixture shown in the report. Reproduce the update and trace the multiline expected-info alignment; done means realigned comments remain correct without adding blank lines at the end of the test case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100