Skip to content

Commit 2f2d254

Browse files
jelmerstephenfin
authored andcommitted
Add more types
1 parent 5da0e88 commit 2f2d254

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

testtools/tests/matchers/test_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ class TestHasLength(TestCase, TestMatchersInterface):
438438
("HasLength(2)", HasLength(2)),
439439
]
440440

441-
describe_examples: ClassVar = [
441+
describe_examples: ClassVar[list] = [
442442
("len([]) != 1", [], HasLength(1)),
443443
]
444444

testtools/tests/matchers/test_const.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ class TestAlwaysInterface(TestMatchersInterface, TestCase):
1212

1313
matches_matcher: ClassVar = Always()
1414
matches_matches: ClassVar = [42, object(), "hi mom"]
15-
matches_mismatches: ClassVar = []
15+
matches_mismatches: ClassVar[list] = []
1616

1717
str_examples: ClassVar = [("Always()", Always())]
18-
describe_examples: ClassVar = []
18+
describe_examples: ClassVar[list] = []
1919

2020

2121
class TestNeverInterface(TestMatchersInterface, TestCase):
2222
""":py:func:`~testtools.matchers.Never` never matches."""
2323

2424
matches_matcher: ClassVar = Never()
25-
matches_matches: ClassVar = []
25+
matches_matches: ClassVar[list] = []
2626
matches_mismatches: ClassVar = [42, object(), "hi mom"]
2727

2828
str_examples: ClassVar = [("Never()", Never())]

testtools/tests/matchers/test_dict.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class TestMatchesAllDictInterface(TestCase, TestMatchersInterface):
3333

3434
class TestKeysEqualEmpty(TestCase, TestMatchersInterface):
3535
matches_matcher: ClassVar = KeysEqual()
36-
matches_matches: ClassVar = [
36+
matches_matches: ClassVar[list] = [
3737
{},
3838
]
3939
matches_mismatches: ClassVar = [
@@ -70,7 +70,7 @@ class TestKeysEqualWithList(TestCase, TestMatchersInterface):
7070
("KeysEqual('foo', 'bar')", KeysEqual("foo", "bar")),
7171
]
7272

73-
describe_examples: ClassVar = []
73+
describe_examples: ClassVar[list] = []
7474

7575
def test_description(self):
7676
matchee = {"foo": 0, "bar": 1, "baz": 2}
@@ -99,8 +99,8 @@ class TestSubDictOf(TestCase, TestMatchersInterface):
9999
{"foo": "bar", "cat": "dog"},
100100
]
101101

102-
str_examples: ClassVar = []
103-
describe_examples: ClassVar = []
102+
str_examples: ClassVar[list] = []
103+
describe_examples: ClassVar[list] = []
104104

105105

106106
class TestMatchesDict(TestCase, TestMatchersInterface):

testtools/tests/matchers/test_exception.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ def boom():
120120

121121
# Tricky to get function objects to render constantly, and the interfaces
122122
# helper uses assertEqual rather than (for instance) DocTestMatches.
123-
str_examples: ClassVar = []
123+
str_examples: ClassVar[list] = []
124124

125-
describe_examples: ClassVar = []
125+
describe_examples: ClassVar[list] = []
126126

127127

128128
class TestRaisesExceptionMatcherInterface(TestCase, TestMatchersInterface):
@@ -143,9 +143,9 @@ def boom_foo():
143143

144144
# Tricky to get function objects to render constantly, and the interfaces
145145
# helper uses assertEqual rather than (for instance) DocTestMatches.
146-
str_examples: ClassVar = []
146+
str_examples: ClassVar[list] = []
147147

148-
describe_examples: ClassVar = []
148+
describe_examples: ClassVar[list] = []
149149

150150

151151
class TestRaisesBaseTypes(TestCase):

testtools/tests/matchers/test_warnings.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class TestWarningMessageCategoryTypeInterface(TestCase, TestMatchersInterface):
4040
matches_matches: ClassVar = [warning_foo]
4141
matches_mismatches: ClassVar = [warning_bar, warning_base]
4242

43-
str_examples: ClassVar = []
44-
describe_examples: ClassVar = []
43+
str_examples: ClassVar[list] = []
44+
describe_examples: ClassVar[list] = []
4545

4646

4747
class TestWarningMessageMessageInterface(TestCase, TestMatchersInterface):
@@ -58,8 +58,8 @@ class TestWarningMessageMessageInterface(TestCase, TestMatchersInterface):
5858
matches_matches: ClassVar = [warning_foo]
5959
matches_mismatches: ClassVar = [warning_bar]
6060

61-
str_examples: ClassVar = []
62-
describe_examples: ClassVar = []
61+
str_examples: ClassVar[list] = []
62+
describe_examples: ClassVar[list] = []
6363

6464

6565
class TestWarningMessageFilenameInterface(TestCase, TestMatchersInterface):
@@ -76,8 +76,8 @@ class TestWarningMessageFilenameInterface(TestCase, TestMatchersInterface):
7676
matches_matches: ClassVar = [warning_foo]
7777
matches_mismatches: ClassVar = [warning_bar]
7878

79-
str_examples: ClassVar = []
80-
describe_examples: ClassVar = []
79+
str_examples: ClassVar[list] = []
80+
describe_examples: ClassVar[list] = []
8181

8282

8383
class TestWarningMessageLineNumberInterface(TestCase, TestMatchersInterface):
@@ -94,8 +94,8 @@ class TestWarningMessageLineNumberInterface(TestCase, TestMatchersInterface):
9494
matches_matches: ClassVar = [warning_foo]
9595
matches_mismatches: ClassVar = [warning_bar]
9696

97-
str_examples: ClassVar = []
98-
describe_examples: ClassVar = []
97+
str_examples: ClassVar[list] = []
98+
describe_examples: ClassVar[list] = []
9999

100100

101101
class TestWarningMessageLineInterface(TestCase, TestMatchersInterface):
@@ -112,8 +112,8 @@ class TestWarningMessageLineInterface(TestCase, TestMatchersInterface):
112112
matches_matches: ClassVar = [warning_foo]
113113
matches_mismatches: ClassVar = [warning_bar]
114114

115-
str_examples: ClassVar = []
116-
describe_examples: ClassVar = []
115+
str_examples: ClassVar[list] = []
116+
describe_examples: ClassVar[list] = []
117117

118118

119119
class TestWarningsInterface(TestCase, TestMatchersInterface):
@@ -133,9 +133,9 @@ def old_func():
133133

134134
# Tricky to get function objects to render constantly, and the interfaces
135135
# helper uses assertEqual rather than (for instance) DocTestMatches.
136-
str_examples: ClassVar = []
136+
str_examples: ClassVar[list] = []
137137

138-
describe_examples: ClassVar = []
138+
describe_examples: ClassVar[list] = []
139139

140140

141141
class TestWarningsMatcherInterface(TestCase, TestMatchersInterface):
@@ -161,8 +161,8 @@ def older_func():
161161
matches_matches: ClassVar = [old_func]
162162
matches_mismatches: ClassVar = [lambda: None, older_func]
163163

164-
str_examples: ClassVar = []
165-
describe_examples: ClassVar = []
164+
str_examples: ClassVar[list] = []
165+
describe_examples: ClassVar[list] = []
166166

167167

168168
class TestWarningsMatcherNoWarningsInterface(TestCase, TestMatchersInterface):
@@ -185,8 +185,8 @@ def warning_func():
185185
matches_matches: ClassVar = [nowarning_func]
186186
matches_mismatches: ClassVar = [warning_func]
187187

188-
str_examples: ClassVar = []
189-
describe_examples: ClassVar = []
188+
str_examples: ClassVar[list] = []
189+
describe_examples: ClassVar[list] = []
190190

191191

192192
class TestWarningMessage(TestCase):

0 commit comments

Comments
 (0)