Skip to content

Commit 4134455

Browse files
authored
Update test/*.py files for PEP585 compliance. (#878)
* Update `comtypes/test/test_client_regenerate_modules.py` for PEP585 compliance. * Update `comtypes/test/test_findgendir.py` for PEP585 compliance. * Update `comtypes/test/test_inout_args.py` for PEP585 compliance. * Update `comtypes/test/test_messageloop.py` for PEP585 compliance.
1 parent 5fd01e3 commit 4134455

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

comtypes/test/test_client_regenerate_modules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import tempfile
66
import types
77
import unittest as ut
8+
from collections.abc import Iterator
89
from pathlib import Path
9-
from typing import Iterator
1010
from unittest import mock
1111

1212
import comtypes

comtypes/test/test_findgendir.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import tempfile
66
import types
77
import unittest
8-
from typing import Iterator
8+
from collections.abc import Iterator
99
from unittest import mock
1010

1111
import comtypes

comtypes/test/test_inout_args.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import unittest as ut
2+
from collections.abc import Callable
23
from ctypes import HRESULT, POINTER, Structure, c_int, c_ulong, c_wchar_p, pointer
3-
from typing import TYPE_CHECKING, Any, Callable, List, NamedTuple, Tuple, Type
4+
from typing import TYPE_CHECKING, Any, NamedTuple
45
from unittest.mock import MagicMock
56

67
import comtypes
@@ -10,7 +11,7 @@
1011
if TYPE_CHECKING:
1112
from comtypes import hints # type: ignore
1213

13-
_ArgSpecType = Tuple[
14+
_ArgSpecType = tuple[
1415
hints.ArgSpecElmType,
1516
hints.ArgSpecElmType,
1617
hints.ArgSpecElmType,
@@ -267,10 +268,10 @@ def test_omitted_arguments_autogen(self):
267268

268269
class PermutedArgspecTestingParams(NamedTuple):
269270
argspec: "_ArgSpecType"
270-
args: Tuple[Any, Any, Any]
271-
orig_ret_val: Tuple[Any, Any, Any]
272-
fixed_ret_val: List[Any]
273-
call_args_validators: List[Tuple[Type[Any], Callable[[Any], Any], Any]]
271+
args: tuple[Any, Any, Any]
272+
orig_ret_val: tuple[Any, Any, Any]
273+
fixed_ret_val: list[Any]
274+
call_args_validators: list[tuple[type[Any], Callable[[Any], Any], Any]]
274275

275276

276277
class Test_ArgspecPermutations(ut.TestCase):
@@ -294,7 +295,7 @@ def test_permutations(self):
294295
self.assertIsInstance(orig, typ)
295296
self.assertEqual(f(orig), val)
296297

297-
def _get_params(self) -> List[PermutedArgspecTestingParams]:
298+
def _get_params(self) -> list[PermutedArgspecTestingParams]:
298299
in_ = MagicMock(spec=POINTER(IUnknown))()
299300
out = POINTER(IUnknown)()
300301
inout1 = 5

comtypes/test/test_messageloop.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import time
33
import unittest
44
from ctypes import WinDLL
5-
from typing import Tuple
65
from unittest.mock import Mock, patch
76

87
import comtypes.messageloop
@@ -31,7 +30,7 @@ class RunInThreadTest(unittest.TestCase):
3130
def setUp(self):
3231
self.msgloop = _MessageLoop()
3332

34-
def run_msgloop_in_thread(self) -> Tuple[threading.Thread, int]:
33+
def run_msgloop_in_thread(self) -> tuple[threading.Thread, int]:
3534
"""Helper method to run message loop in a separate thread."""
3635
thread_ids = []
3736

0 commit comments

Comments
 (0)