python / python/mypy

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

オープン
#19,940 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug topic-developer topic-tests
主要言語
Python
スター
20.6k
フォーク
3.3k
PR マージ指標
PR 指標を取得中

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

レポートに示されている --update-data エントリーポイントと testErrorCodeIgnoreMultiple1 fixture から始めます。更新を再現し、複数行の expected-info の配置を追跡します。テストケースの末尾に空行を追加せず、再配置されたコメントが正しいままであれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
testing-qa, tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。