Skip to content

Commit 67d23de

Browse files
committed
fix and add test case
1 parent 563d7b8 commit 67d23de

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

mypy/checkstrformat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ def conversion_type(
10731073
return UnionType(
10741074
[self.named_type("builtins.int"), self.named_type("builtins.str")]
10751075
)
1076-
elif p in ["<", ">", "=", "^"]:
1076+
elif p.startswith(("<", ">", "=", "^")):
10771077
return UnionType(
10781078
[
10791079
self.named_type("builtins.int"),

test-data/unit/check-errorcodes.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ def g() -> int:
645645

646646
'{}'.format(b'abc') # E: If x = b'abc' then f"{x}" or "{}".format(x) produces "b'abc'", not "abc". If this is desired behavior, use f"{x!r}" or "{!r}".format(x). Otherwise, decode the bytes [str-bytes-safe]
647647
'%s' % b'abc' # E: If x = b'abc' then "%s" % x produces "b'abc'", not "abc". If this is desired behavior use "%r" % x. Otherwise, decode the bytes [str-bytes-safe]
648+
'{:>2}'.format(None)
648649
[builtins fixtures/primitives.pyi]
649650
[typing fixtures/typing-medium.pyi]
650651

0 commit comments

Comments
 (0)