Skip to content

Commit 6191aaa

Browse files
jelmerstephenfin
authored andcommitted
Fix ruff issues
1 parent 2f2d254 commit 6191aaa

File tree

9 files changed

+18
-14
lines changed

9 files changed

+18
-14
lines changed

testtools/helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright (c) 2010-2012 testtools developers. See LICENSE for details.
22

3-
from typing import Any, Callable, TypeVar
3+
from collections.abc import Callable
4+
from typing import Any, TypeVar
45

56
T = TypeVar("T")
67
K = TypeVar("K")

testtools/matchers/_basic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717

1818
import operator
1919
import re
20+
from collections.abc import Callable
2021
from pprint import pformat
21-
from typing import Any, Callable
22+
from typing import Any
2223

2324
from ..compat import (
2425
text_repr,

testtools/testcase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import itertools
2121
import sys
2222
import unittest
23-
from typing import Any, Protocol, TypeVar, Union
23+
from typing import Any, Protocol, TypeVar
2424
from unittest.case import SkipTest
2525

2626
from testtools import content
@@ -1117,7 +1117,7 @@ def __exit__(self, exc_type, exc_value, traceback):
11171117
return False
11181118
if self.value_re:
11191119
exception_matcher = MatchesException(self.exc_type, self.value_re)
1120-
matcher: Union[Matcher, Annotate]
1120+
matcher: Matcher | Annotate
11211121
if self.msg:
11221122
matcher = Annotate(self.msg, exception_matcher)
11231123
else:

testtools/testresult/real.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import sys
2929
import unittest
3030
from operator import methodcaller
31-
from typing import ClassVar, Union
31+
from typing import ClassVar
3232

3333
from testtools.compat import _b
3434
from testtools.content import (
@@ -1743,7 +1743,7 @@ def __init__(self, decorated):
17431743
# Deal with mismatched base class constructors.
17441744
TestControl.__init__(self)
17451745
self._started = False
1746-
self._tags: Union[TagContext, None] = None
1746+
self._tags: TagContext | None = None
17471747

17481748
def _get_failfast(self):
17491749
return len(self.targets) == 2

testtools/tests/matchers/helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright (c) 2008-2012 testtools developers. See LICENSE for details.
22

3-
from typing import Any, Callable, ClassVar, Protocol, runtime_checkable
3+
from collections.abc import Callable
4+
from typing import Any, ClassVar, Protocol, runtime_checkable
45

56

67
@runtime_checkable

testtools/tests/matchers/test_filesystem.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import shutil
55
import tarfile
66
import tempfile
7-
from typing import Any, Callable
7+
from collections.abc import Callable
8+
from typing import Any
89

910
from testtools import TestCase
1011
from testtools.matchers import (

testtools/tests/test_assert_that.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
from collections.abc import Callable
12
from doctest import ELLIPSIS
2-
from typing import Any, Callable
3+
from typing import Any
34

45
from testtools import (
56
TestCase,

testtools/tests/test_testsuite.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import doctest
66
import unittest
77
from pprint import pformat
8-
from typing import Union
98

109
from testtools import (
1110
ConcurrentStreamTestSuite,
@@ -354,7 +353,7 @@ def setUp(self):
354353
self.skipTest("Need fixtures")
355354

356355
def test_fixture_suite(self):
357-
log: list[Union[int, str]] = []
356+
log: list[int | str] = []
358357

359358
class Sample(TestCase):
360359
def test_one(self):
@@ -371,7 +370,7 @@ def test_two(self):
371370
self.assertEqual(["setUp", 1, 2, "tearDown"], log)
372371

373372
def test_fixture_suite_sort(self):
374-
log: list[Union[int, str]] = []
373+
log: list[int | str] = []
375374

376375
class Sample(TestCase):
377376
def test_one(self):

testtools/tests/twistedsupport/_helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
"NeedsTwistedTestCase",
55
]
66

7-
from typing import TYPE_CHECKING, Optional
7+
from typing import TYPE_CHECKING
88

99
from testtools import TestCase
1010

1111
if TYPE_CHECKING:
1212
from types import ModuleType
1313

14-
defer: Optional[ModuleType]
14+
defer: ModuleType | None
1515
else:
1616
try:
1717
from twisted.internet import defer

0 commit comments

Comments
 (0)