|
1 | 1 | """Tests for C-implemented GenericAlias.""" |
2 | 2 |
|
3 | 3 | import unittest |
4 | | -from test import support |
5 | | -from test.support import import_helper |
6 | 4 | import pickle |
7 | 5 | from array import array |
8 | 6 | import copy |
|
64 | 62 | from string.templatelib import Template, Interpolation |
65 | 63 |
|
66 | 64 | import typing |
67 | | -from typing import TypeVar, TypeVarTuple, Unpack |
| 65 | +from typing import TypeVar, Unpack |
68 | 66 | T = TypeVar('T') |
69 | 67 | K = TypeVar('K') |
70 | 68 | V = TypeVar('V') |
71 | | -Ts = TypeVarTuple("Ts") |
72 | 69 |
|
73 | 70 | _UNPACKED_TUPLES = [ |
74 | 71 | # Unpacked tuple using `*` |
|
100 | 97 | tuple[*tuple[Unpack[tuple[int, ...]]]], |
101 | 98 | ] |
102 | 99 |
|
103 | | -_testcapi = import_helper.import_module("_testcapi") |
104 | | - |
105 | 100 | class BaseTest(unittest.TestCase): |
106 | 101 | """Test basics.""" |
107 | 102 | generic_types = [type, tuple, list, dict, frozendict, |
@@ -632,29 +627,6 @@ def test_gh150146(self): |
632 | 627 | with self.assertRaises(TypeError): |
633 | 628 | x[*typing.Mapping[..., ...]] |
634 | 629 |
|
635 | | - @support.nomemtest |
636 | | - def test_subs_tvars_nomemory(self): |
637 | | - alias = dict[str, tuple[*Ts]] |
638 | | - key = (int, str) |
639 | | - |
640 | | - # Warm the code path to stabilize the allocation window. |
641 | | - # This injection point was determined experimentally for this build. |
642 | | - try: |
643 | | - dict[str, tuple[int, str]] |
644 | | - except Exception: |
645 | | - pass |
646 | | - |
647 | | - _testcapi.set_nomemory(24, 25) |
648 | | - raised = False |
649 | | - try: |
650 | | - alias[key] |
651 | | - except MemoryError: |
652 | | - raised = True |
653 | | - finally: |
654 | | - _testcapi.remove_mem_hooks() |
655 | | - |
656 | | - self.assertTrue(raised, "MemoryError not raised") |
657 | | - |
658 | 630 |
|
659 | 631 | class TypeIterationTests(unittest.TestCase): |
660 | 632 | _UNITERABLE_TYPES = (list, tuple) |
|
0 commit comments