8000 Replace type comments with annotations (#98) · python/typing_extensions@ad3966d · GitHub
[go: up one dir, main page]

Skip to content

Commit ad3966d

Browse files
authored
Replace type comments with annotations (#98)
1 parent b56468c commit ad3966d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines ch 8000 anged

src/test_typing_extensions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -930,14 +930,14 @@ def test_coroutine(self):
930930
pass
931931

932932
def test_async_iterable(self):
933-
base_it = range(10) # type: Iterator[int]
933+
base_it: Iterator[int] = range(10)
934934
it = AsyncIteratorWrapper(base_it)
935935
self.assertIsInstance(it, typing_extensions.AsyncIterable)
936936
self.assertIsInstance(it, typing_extensions.AsyncIterable)
937937
self.assertNotIsInstance(42, typing_extensions.AsyncIterable)
938938

939939
def test_async_iterator(self):
940-
base_it = range(10) # type: Iterator[int]
940+
base_it: Iterator[int] = range(10)
941941
it = AsyncIteratorWrapper(base_it)
942942
self.assertIsInstance(it, typing_extensions.AsyncIterator)
943943
self.assertNotIsInstance(42, typing_extensions.AsyncIterator)
@@ -1697,7 +1697,7 @@ class Concrete(Proto):
16971697
def test_none_treated_correctly(self):
16981698
@runtime
16991699
class P(Protocol):
1700-
x = None # type: int
1700+
x: int = None
17011701
class B(object): pass
17021702
self.assertNotIsInstance(B(), P)
17031703
class C:
@@ -1717,7 +1717,7 @@ def __init__(self):
17171717

17181718
def test_protocols_in_unions(self):
17191719
class P(Protocol):
1720-
x = None # type: int
1720+
x: int = None
17211721
Alias = typing.Union[typing.Iterable, P]
17221722
Alias2 = typing.Union[P, typing.Iterable]
17231723
self.assertEqual(Alias, Alias2)
@@ -2388,7 +2388,7 @@ def test_canonical_usage_with_variable_annotation(self):
23882388
exec('Alias: TypeAlias = Employee', globals(), ns)
23892389

23902390
def test_canonical_usage_with_type_comment(self):
2391-
Alias = Employee # type: TypeAlias
2391+
Alias: TypeAlias = Employee
23922392

23932393
def test_cannot_instantiate(self):
23942394
with self.assertRaises(TypeError):

0 commit comments

Comments
 (0)
0