File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -484,6 +484,23 @@ class D(bytes):
484484'{}'.format(D())
485485[builtins fixtures/primitives.pyi]
486486
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+
487504[case testFormatCallFinal]
488505from typing_extensions import Final
489506
You can’t perform that action at this time.
0 commit comments