From 0df575704970762ac9609bc01ef6224641e6fb12 Mon Sep 17 00:00:00 2001 From: YingqiDuan Date: Wed, 29 Jul 2026 13:12:30 -0700 Subject: [PATCH 1/2] Move trailing comma config tests to check tests Refs #5966. --- test-data/unit/check-flags.test | 13 ++++++++++--- test-data/unit/cmdline.test | 26 -------------------------- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/test-data/unit/check-flags.test b/test-data/unit/check-flags.test index acdee2a10430a..c472445577a53 100644 --- a/test-data/unit/check-flags.test +++ b/test-data/unit/check-flags.test @@ -1634,7 +1634,9 @@ if BLAH: [file mypy.ini] \[mypy] ignore_missing_imports = True -always_true = YOLO1, YOLO +always_true = + YOLO1, + YOLO, always_false = BLAH, BLAH1 [builtins fixtures/bool.pyi] @@ -1663,7 +1665,9 @@ def bar(): pass [file mypy.ini] \[mypy] -disable_error_code = import, no-untyped-def +disable_error_code = + import, + no-untyped-def, [case testDisableErrorCodeConfigFilePyProjectTOML] @@ -2529,7 +2533,10 @@ if foo: ... # E: Function "foo" could always be true in boolean context 42 + "no" # type: ignore [file mypy.ini] \[mypy] -enable_error_code = ignore-without-code, truthy-bool, used-before-def +enable_error_code = + used-before-def, + ignore-without-code, + truthy-bool, \[mypy-tests.*] disable_error_code = ignore-without-code diff --git a/test-data/unit/cmdline.test b/test-data/unit/cmdline.test index 7066034b3e39c..53d64f21754e3 100644 --- a/test-data/unit/cmdline.test +++ b/test-data/unit/cmdline.test @@ -1210,32 +1210,6 @@ y: int = 'y' # E: Incompatible types in assignment (expression has type "str", z: int = 'z' [out] -[case testCmdlineCfgEnableErrorCodeTrailingComma] -# cmd: mypy . -[file mypy.ini] -\[mypy] -enable_error_code = - truthy-bool, - redundant-expr, -[out] - -[case testCmdlineCfgDisableErrorCodeTrailingComma] -# cmd: mypy . -[file mypy.ini] -\[mypy] -disable_error_code = - misc, - override, -[out] - -[case testCmdlineCfgAlwaysTrueTrailingComma] -# cmd: mypy . -[file mypy.ini] -\[mypy] -always_true = - MY_VAR, -[out] - [case testCmdlineCfgModulesTrailingComma] # cmd: mypy [file mypy.ini] From 9928a819149800ff7ab0381c6da5e48d04d4c18b Mon Sep 17 00:00:00 2001 From: YingqiDuan <141370165+YingqiDuan@users.noreply.github.com> Date: Thu, 30 Jul 2026 14:55:59 -0700 Subject: [PATCH 2/2] Document trailing-comma coverage in check tests --- test-data/unit/check-flags.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test-data/unit/check-flags.test b/test-data/unit/check-flags.test index c472445577a53..59ca9bc4e4e78 100644 --- a/test-data/unit/check-flags.test +++ b/test-data/unit/check-flags.test @@ -1634,6 +1634,7 @@ if BLAH: [file mypy.ini] \[mypy] ignore_missing_imports = True +# Keep `YOLO` last to verify it is parsed when the list has a trailing comma. always_true = YOLO1, YOLO, @@ -1665,6 +1666,7 @@ def bar(): pass [file mypy.ini] \[mypy] +# Keep `no-untyped-def` last to verify it is parsed when the list has a trailing comma. disable_error_code = import, no-untyped-def, @@ -2533,6 +2535,7 @@ if foo: ... # E: Function "foo" could always be true in boolean context 42 + "no" # type: ignore [file mypy.ini] \[mypy] +# Keep `truthy-bool` last to verify it is parsed when the list has a trailing comma. enable_error_code = used-before-def, ignore-without-code,