mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
annotationlib: Move ForwardRef tests to test_annotationlib (#132571)
I started with just moving ForwardRefTests to test_annotationlib, but found that it contained a number of tests for no_type_check, which I moved to a new class in test_typing, as well as a number of tests that are more appropriately classified as tests for get_type_hints(). One test, test_forward_equality_namespace(), was somewhat accidentally depending on a global class A in test_typing. I added a class A in the annotationlib tests instead. Also add a useful comment in annotationlib.
This commit is contained in:
parent
10a77619f9
commit
7dcaebfb21
3 changed files with 320 additions and 314 deletions
|
@ -77,11 +77,15 @@ class ForwardRef:
|
|||
self.__forward_is_argument__ = is_argument
|
||||
self.__forward_is_class__ = is_class
|
||||
self.__forward_module__ = module
|
||||
self.__owner__ = owner
|
||||
# These are always set to None here but may be non-None if a ForwardRef
|
||||
# is created through __class__ assignment on a _Stringifier object.
|
||||
self.__globals__ = None
|
||||
self.__cell__ = None
|
||||
# These are initially None but serve as a cache and may be set to a non-None
|
||||
# value later.
|
||||
self.__code__ = None
|
||||
self.__ast_node__ = None
|
||||
self.__cell__ = None
|
||||
self.__owner__ = owner
|
||||
|
||||
def __init_subclass__(cls, /, *args, **kwds):
|
||||
raise TypeError("Cannot subclass ForwardRef")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue