pytypes icon indicating copy to clipboard operation
pytypes copied to clipboard

Generator expression is not considered Iterable

Open jolaf opened this issue 6 years ago • 0 comments

The following code:

from typing import Iterable

from pytypes import TypeChecker

def f(a: Iterable[str]) -> None:
    pass

with TypeChecker():
    f((c for c in 'abc'))
    print("OK")

fails as follows:

$ python3 Test.py
Traceback (most recent call last):
  File "Test.py", line 9, in <module>
    f((c for c in 'abc'))
  File "Test.py", line 5, in f
    def f(a: Iterable[str]) -> None:
pytypes.exceptions.InputTypeError: 
  __main__.f
  called with incompatible types:
Expected: Tuple[Iterable[str]]
Received: Tuple[Generator]

jolaf avatar Aug 27 '19 14:08 jolaf