Created
May 6, 2019 07:31
-
-
Save lovasoa/74ea62a89f5bf073b0e0c2f222008ae3 to your computer and use it in GitHub Desktop.
typing.get_type_hints fails when used with a class defined in a documentation test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 -m doctest | |
from __future__ import annotations | |
import typing | |
def f(clazz): | |
""" | |
>>> class MyClass: | |
... pass | |
>>> class MyOtherClass: | |
... my_field: MyClass | |
>>> f(MyOtherClass) | |
""" | |
typing.get_type_hints(clazz) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 -m doctest | |
import typing | |
def f(clazz): | |
""" | |
>>> class MyClass: | |
... my_field: 'MyClass' | |
>>> f(MyClass) | |
""" | |
typing.get_type_hints(clazz) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment