Skip to content

Commit 32c4334

Browse files
authored
Remove unrelated tests
1 parent f676ac0 commit 32c4334

1 file changed

Lines changed: 0 additions & 103 deletions

File tree

Lib/test/test_typing.py

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -10670,109 +10670,6 @@ def test_eq(self):
1067010670
with self.assertWarns(DeprecationWarning):
1067110671
self.assertNotEqual(int, typing._UnionGenericAlias)
1067210672

10673-
class MyType:
10674-
pass
10675-
10676-
class TestGenericAliasHandling(BaseTestCase):
10677-
10678-
def test_forward_ref(self):
10679-
fwd_ref = ForwardRef('MyType')
10680-
10681-
def func(arg: fwd_ref):
10682-
pass
10683-
10684-
result = get_type_hints(func)
10685-
self.assertEqual(result['arg'], MyType, f"Expected MyType, got {result['arg']}")
10686-
10687-
def test_generic_alias(self):
10688-
fwd_ref = ForwardRef('MyType')
10689-
generic_list = List[fwd_ref]
10690-
10691-
def func(arg: generic_list):
10692-
pass
10693-
10694-
result = get_type_hints(func)
10695-
self.assertEqual(result['arg'], List[MyType], f"Expected List[MyType], got {result['arg']}")
10696-
10697-
def test_union(self):
10698-
fwd_ref_1 = ForwardRef('MyType')
10699-
fwd_ref_2 = ForwardRef('int')
10700-
union_type = Union[fwd_ref_1, fwd_ref_2]
10701-
10702-
def func(arg: union_type):
10703-
pass
10704-
10705-
result = get_type_hints(func)
10706-
self.assertEqual(result['arg'], Union[MyType, int], f"Expected Union[MyType, int], got {result['arg']}")
10707-
10708-
def test_recursive_forward_ref(self):
10709-
recursive_ref = ForwardRef('RecursiveType')
10710-
globals()['RecursiveType'] = recursive_ref
10711-
recursive_type = Dict[str, List[recursive_ref]]
10712-
10713-
def func(arg: recursive_type):
10714-
pass
10715-
10716-
result = get_type_hints(func)
10717-
self.assertEqual(result['arg'], Dict[str, List[recursive_ref]], f"Expected Dict[str, List[RecursiveType]], got {result['arg']}")
10718-
10719-
def test_callable_unpacking(self):
10720-
fwd_ref = ForwardRef('MyType')
10721-
callable_type = Callable[[fwd_ref, int], str]
10722-
10723-
def func(arg1: fwd_ref, arg2: int) -> str:
10724-
return "test"
10725-
10726-
result = get_type_hints(func)
10727-
self.assertEqual(result['arg1'], MyType, f"Expected MyType for arg1, got {result['arg1']}")
10728-
self.assertEqual(result['arg2'], int, f"Expected int for arg2, got {result['arg2']}")
10729-
self.assertEqual(result['return'], str, f"Expected str for return, got {result['return']}")
10730-
10731-
def test_unpacked_generic(self):
10732-
fwd_ref = ForwardRef('MyType')
10733-
generic_type = Tuple[fwd_ref, int]
10734-
10735-
def func(arg: generic_type):
10736-
pass
10737-
10738-
result = get_type_hints(func)
10739-
self.assertEqual(result['arg'], Tuple[MyType, int], f"Expected Tuple[MyType, int], got {result['arg']}")
10740-
10741-
def test_preservation_of_type(self):
10742-
fwd_ref_1 = ForwardRef('MyType')
10743-
fwd_ref_2 = ForwardRef('int')
10744-
complex_type = Dict[str, Union[fwd_ref_1, fwd_ref_2]]
10745-
10746-
def func(arg: complex_type):
10747-
pass
10748-
10749-
result = get_type_hints(func)
10750-
self.assertEqual(result['arg'], Dict[str, Union[MyType, int]], f"Expected Dict[str, Union[MyType, int]], got {result['arg']}")
10751-
10752-
def test_callable_unflattening(self):
10753-
callable_type = Callable[[int, str], bool]
10754-
10755-
def func(arg1: int, arg2: str) -> bool:
10756-
return True
10757-
10758-
result = get_type_hints(func)
10759-
self.assertEqual(result['arg1'], int, f"Expected int for arg1, got {result['arg1']}")
10760-
self.assertEqual(result['arg2'], str, f"Expected str for arg2, got {result['arg2']}")
10761-
self.assertEqual(result['return'], bool, f"Expected bool for return, got {result['return']}")
10762-
10763-
callable_type_packed = Callable[[int, str], bool]
10764-
10765-
def func_packed(arg1: int, arg2: str) -> bool:
10766-
return True
10767-
10768-
result = get_type_hints(func_packed)
10769-
self.assertEqual(result['arg1'], int, f"Expected int for arg1, got {result['arg1']}")
10770-
self.assertEqual(result['arg2'], str, f"Expected str for arg2, got {result['arg2']}")
10771-
self.assertEqual(result['return'], bool, f"Expected bool for return, got {result['return']}")
10772-
10773-
def test_hashable(self):
10774-
self.assertEqual(hash(typing._UnionGenericAlias), hash(Union))
10775-
1077610673
class TestCallableAlias(BaseTestCase):
1077710674
def test_callable_alias_preserves_subclass(self):
1077810675
C = ABCallable[[str, ForwardRef('int')], int]

0 commit comments

Comments
 (0)