Ivan Levkivskyi <[email protected]> added the comment:
I think this is related to doc tests being executed in a namespace where the
class definition is not available. I am not sure what is the best way here, a
workaround is to explicitly pass the namespace, for example this passes:
import typing
def f(clazz, ns):
"""
>>> class MyClass:
... my_field: 'MyClass'
>>> f(MyClass, globals())
"""
typing.get_type_hints(clazz, ns)
You can maybe make the ns parameter optional, but it still doesn't look like a
good solution.
----------
nosy: +levkivskyi
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36810>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com