@@ -2467,3 +2467,45 @@ A = Union[C, List] # OK
24672467-- check_untyped_defs is False by default.
24682468def f():
24692469 x: int = "no" # N: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs
2470+
2471+ [case testSpotCheckErrorCodeAll]
2472+ # flags: --enable-error-code all
2473+ # It would be annoying to check every error here, so let's just check a couple.
2474+ from typing import override
2475+
2476+ class Parent:
2477+ def f(self, x: int) -> None:
2478+ pass
2479+
2480+ def g(self, y: int) -> bool:
2481+ return True
2482+
2483+ class Child(Parent):
2484+ def f(self, x: int) -> None: # E: Missing @override decorator
2485+ pass
2486+
2487+ @override
2488+ def g(self, y: int) -> bool: #type: ignore # E: Unused "type: ignore" comment # E: "type: ignore" comment without error code
2489+ return True
2490+
2491+ [case testSpotCheckErrorCodeAllNotUsed]
2492+ # This test case exists purely to ensure that the testSpotCheckErrorCodeAll test does not become obsolete.
2493+ # (For example, if all the errors expected by testSpotCheckErrorCodeAll get turned on by default, then
2494+ # the testSpotCheckErrorCodeAll test would fail to guarantee the enablement of any additional errors!)
2495+
2496+ from typing import override
2497+
2498+ class Parent:
2499+ def f(self, x: int) -> None:
2500+ pass
2501+
2502+ def g(self, y: int) -> bool:
2503+ return True
2504+
2505+ class Child(Parent):
2506+ def f(self, x: int) -> None:
2507+ pass
2508+
2509+ @override
2510+ def g(self, y: int) -> bool: #type: ignore
2511+ return True
0 commit comments