Skip to content

Commit

Permalink
Replace type comments with annotations (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
hegjon committed Nov 25, 2022
1 parent b56468c commit ad3966d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/test_typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit ad3966d

Please sign in to comment.