File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -484,6 +484,23 @@ class D(bytes):
484
484
'{}'.format(D())
485
485
[builtins fixtures/primitives.pyi]
486
486
487
+ [case testNoSpuriousFormattingErrorsDuringFailedOverlodMatch]
488
+ from typing import overload, Callable
489
+
490
+ @overload
491
+ def sub(pattern: str, repl: Callable[[str], str]) -> str: ...
492
+ @overload
493
+ def sub(pattern: bytes, repl: Callable[[bytes], bytes]) -> bytes: ...
494
+ def sub(pattern: object, repl: object) -> object:
495
+ pass
496
+
497
+ def better_snakecase(text: str) -> str:
498
+ # Mypy used to emit a spurious error here
499
+ # warning about interpolating bytes into an f-string:
500
+ text = sub(r"([A-Z])([A-Z]+)([A-Z](?:[^A-Z]|$))", lambda match: f"{match}")
501
+ return text
502
+ [builtins fixtures/primitives.pyi]
503
+
487
504
[case testFormatCallFinal]
488
505
from typing_extensions import Final
489
506
You can’t perform that action at this time.
0 commit comments