| 1 |
"""Module for testing the behavior of generics across different modules.""" |
| 2 |
|
| 3 |
from typing import TypeVar, Generic, Optional, TypeAliasType |
| 4 |
|
| 5 |
default_a: Optional['A'] = None |
| 6 |
default_b: Optional['B'] = None |
| 7 |
|
| 8 |
T = TypeVar('T') |
| 9 |
|
| 10 |
|
| 11 |
class A(Generic[T]): |
| 12 |
some_b: 'B' |
| 13 |
|
| 14 |
|
| 15 |
class B(Generic[T]): |
| 16 |
class A(Generic[T]): |
| 17 |
pass |
| 18 |
|
| 19 |
my_inner_a1: 'B.A' |
| 20 |
my_inner_a2: A |
| 21 |
my_outer_a: 'A' # unless somebody calls get_type_hints with localns=B.__dict__ |
| 22 |
|
| 23 |
type Alias = int |
| 24 |
OldStyle = TypeAliasType("OldStyle", int) |