python / python/mypy

`--update-data` introduces new blank lines when aligning multi-line expected info comments

Offen
#19,940 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug topic-developer topic-tests
Vorherrschende Sprache
Python
Sterne
20.6k
Forks
3.3k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem --update-data-Einstiegspunkt und dem im Bericht gezeigten Fixture testErrorCodeIgnoreMultiple1. Führe das Update erneut aus und verfolge die Ausrichtung der mehrzeiligen expected-info; abgeschlossen ist die Aufgabe, wenn neu ausgerichtete Kommentare weiterhin korrekt sind, ohne am Ende des Testfalls Leerzeilen hinzuzufügen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
testing-qa, tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.