From 1653b51d22c31a17b070b1e21b56609d776681c4 Mon Sep 17 00:00:00 2001 From: "dixith@hotmail.com" Date: Mon, 22 Mar 2021 02:14:22 +0530 Subject: [PATCH] USe double quotes in error message "is not a valid TypedDict key" --- mypy/messages.py | 2 +- test-data/unit/check-typeddict.test | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mypy/messages.py b/mypy/messages.py index 1cf3ba87c14f..cd0b491768a9 100644 --- a/mypy/messages.py +++ b/mypy/messages.py @@ -1164,7 +1164,7 @@ def typeddict_key_not_found( item_name: str, context: Context) -> None: if typ.is_anonymous(): - self.fail('\'{}\' is not a valid TypedDict key; expected one of {}'.format( + self.fail('"{}" is not a valid TypedDict key; expected one of {}'.format( item_name, format_item_name_list(typ.items.keys())), context) else: self.fail('TypedDict {} has no key "{}"'.format( diff --git a/test-data/unit/check-typeddict.test b/test-data/unit/check-typeddict.test index 1b253dc9c56d..73006eb4f3fa 100644 --- a/test-data/unit/check-typeddict.test +++ b/test-data/unit/check-typeddict.test @@ -702,8 +702,8 @@ T = TypeVar('T') def join(x: T, y: T) -> T: return x ab = join(A(x='', y=1, z=''), B(x='', z=1)) ac = join(A(x='', y=1, z=''), C(x='', y=0, z=1)) -ab['y'] # E: 'y' is not a valid TypedDict key; expected one of ('x') -ac['a'] # E: 'a' is not a valid TypedDict key; expected one of ('x', 'y') +ab['y'] # E: "y" is not a valid TypedDict key; expected one of ('x') +ac['a'] # E: "a" is not a valid TypedDict key; expected one of ('x', 'y') [builtins fixtures/dict.pyi] [case testCannotGetItemOfTypedDictWithNonLiteralKey]