Skip to content

Commit 641919f

Browse files
Use double quotes in error message "is not a valid TypedDict key" (#10235)
Co-authored-by: [email protected] <[email protected]>
1 parent 764f926 commit 641919f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

mypy/messages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,7 @@ def typeddict_key_not_found(
11641164
item_name: str,
11651165
context: Context) -> None:
11661166
if typ.is_anonymous():
1167-
self.fail('\'{}\' is not a valid TypedDict key; expected one of {}'.format(
1167+
self.fail('"{}" is not a valid TypedDict key; expected one of {}'.format(
11681168
item_name, format_item_name_list(typ.items.keys())), context)
11691169
else:
11701170
self.fail('TypedDict {} has no key "{}"'.format(

test-data/unit/check-typeddict.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,8 +702,8 @@ T = TypeVar('T')
702702
def join(x: T, y: T) -> T: return x
703703
ab = join(A(x='', y=1, z=''), B(x='', z=1))
704704
ac = join(A(x='', y=1, z=''), C(x='', y=0, z=1))
705-
ab['y'] # E: 'y' is not a valid TypedDict key; expected one of ('x')
706-
ac['a'] # E: 'a' is not a valid TypedDict key; expected one of ('x', 'y')
705+
ab['y'] # E: "y" is not a valid TypedDict key; expected one of ('x')
706+
ac['a'] # E: "a" is not a valid TypedDict key; expected one of ('x', 'y')
707707
[builtins fixtures/dict.pyi]
708708

709709
[case testCannotGetItemOfTypedDictWithNonLiteralKey]

0 commit comments

Comments
 (0)