From ad3966ddabe9adcbf2e76d88a7cf984fa9cb4237 Mon Sep 17 00:00:00 2001 From: Jonny Heggheim Date: Fri, 25 Nov 2022 15:42:21 +0100 Subject: [PATCH] Replace type comments with annotations (#98) --- src/test_typing_extensions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test_typing_extensions.py b/src/test_typing_extensions.py index 770389b1..f19f1cfd 100644 --- a/src/test_typing_extensions.py +++ b/src/test_typing_extensions.py @@ -930,14 +930,14 @@ def test_coroutine(self): pass def test_async_iterable(self): - base_it = range(10) # type: Iterator[int] + base_it: Iterator[int] = range(10) it = AsyncIteratorWrapper(base_it) self.assertIsInstance(it, typing_extensions.AsyncIterable) self.assertIsInstance(it, typing_extensions.AsyncIterable) self.assertNotIsInstance(42, typing_extensions.AsyncIterable) def test_async_iterator(self): - base_it = range(10) # type: Iterator[int] + base_it: Iterator[int] = range(10) it = AsyncIteratorWrapper(base_it) self.assertIsInstance(it, typing_extensions.AsyncIterator) self.assertNotIsInstance(42, typing_extensions.AsyncIterator) @@ -1697,7 +1697,7 @@ class Concrete(Proto): def test_none_treated_correctly(self): @runtime class P(Protocol): - x = None # type: int + x: int = None class B(object): pass self.assertNotIsInstance(B(), P) class C: @@ -1717,7 +1717,7 @@ def __init__(self): def test_protocols_in_unions(self): class P(Protocol): - x = None # type: int + x: int = None Alias = typing.Union[typing.Iterable, P] Alias2 = typing.Union[P, typing.Iterable] self.assertEqual(Alias, Alias2) @@ -2388,7 +2388,7 @@ def test_canonical_usage_with_variable_annotation(self): exec('Alias: TypeAlias = Employee', globals(), ns) def test_canonical_usage_with_type_comment(self): - Alias = Employee # type: TypeAlias + Alias: TypeAlias = Employee def test_cannot_instantiate(self): with self.assertRaises(TypeError):