Skip to content

Commit e094ae3

Browse files
Remove mypy overrides for tests/test_directives/test_directive_code.py (#13765)
1 parent 44f0d7d commit e094ae3

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

tests/test_directives/test_directive_code.py

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020

2121

2222
@pytest.fixture(scope='module')
23-
def testroot(rootdir):
23+
def testroot(rootdir: Path) -> Path:
2424
testroot_path = rootdir / 'test-directive-code'
2525
return testroot_path
2626

2727

2828
@pytest.fixture(scope='module')
29-
def literal_inc_path(testroot):
29+
def literal_inc_path(testroot: Path) -> Path:
3030
return testroot / 'literal.inc'
3131

3232

33-
def test_LiteralIncludeReader(literal_inc_path):
33+
def test_LiteralIncludeReader(literal_inc_path: Path) -> None:
3434
options = {'lineno-match': True}
3535
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
3636
content, lines = reader.read()
@@ -39,7 +39,7 @@ def test_LiteralIncludeReader(literal_inc_path):
3939
assert reader.lineno_start == 1
4040

4141

42-
def test_LiteralIncludeReader_lineno_start(literal_inc_path):
42+
def test_LiteralIncludeReader_lineno_start(literal_inc_path: Path) -> None:
4343
options = {'lineno-start': 4}
4444
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
4545
content, lines = reader.read()
@@ -48,37 +48,37 @@ def test_LiteralIncludeReader_lineno_start(literal_inc_path):
4848
assert reader.lineno_start == 4
4949

5050

51-
def test_LiteralIncludeReader_pyobject1(literal_inc_path):
51+
def test_LiteralIncludeReader_pyobject1(literal_inc_path: Path) -> None:
5252
options = {'lineno-match': True, 'pyobject': 'Foo'}
5353
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
5454
content, _lines = reader.read()
5555
assert content == 'class Foo:\n pass\n'
5656
assert reader.lineno_start == 5
5757

5858

59-
def test_LiteralIncludeReader_pyobject2(literal_inc_path):
59+
def test_LiteralIncludeReader_pyobject2(literal_inc_path: Path) -> None:
6060
options = {'pyobject': 'Bar'}
6161
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
6262
content, _lines = reader.read()
6363
assert content == 'class Bar:\n def baz():\n pass\n'
6464
assert reader.lineno_start == 1 # no lineno-match
6565

6666

67-
def test_LiteralIncludeReader_pyobject3(literal_inc_path):
67+
def test_LiteralIncludeReader_pyobject3(literal_inc_path: Path) -> None:
6868
options = {'pyobject': 'Bar.baz'}
6969
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
7070
content, _lines = reader.read()
7171
assert content == ' def baz():\n pass\n'
7272

7373

74-
def test_LiteralIncludeReader_pyobject_and_lines(literal_inc_path):
74+
def test_LiteralIncludeReader_pyobject_and_lines(literal_inc_path: Path) -> None:
7575
options = {'pyobject': 'Bar', 'lines': '2-'}
7676
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
7777
content, _lines = reader.read()
7878
assert content == ' def baz():\n pass\n'
7979

8080

81-
def test_LiteralIncludeReader_lines1(literal_inc_path):
81+
def test_LiteralIncludeReader_lines1(literal_inc_path: Path) -> None:
8282
options = {'lines': '1-3'}
8383
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
8484
content, _lines = reader.read()
@@ -89,7 +89,7 @@ def test_LiteralIncludeReader_lines1(literal_inc_path):
8989
)
9090

9191

92-
def test_LiteralIncludeReader_lines2(literal_inc_path):
92+
def test_LiteralIncludeReader_lines2(literal_inc_path: Path) -> None:
9393
options = {'lines': '1,3,5'}
9494
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
9595
content, _lines = reader.read()
@@ -100,7 +100,7 @@ def test_LiteralIncludeReader_lines2(literal_inc_path):
100100
)
101101

102102

103-
def test_LiteralIncludeReader_lines_and_lineno_match1(literal_inc_path):
103+
def test_LiteralIncludeReader_lines_and_lineno_match1(literal_inc_path: Path) -> None:
104104
options = {'lines': '3-5', 'lineno-match': True}
105105
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
106106
content, _lines = reader.read()
@@ -109,7 +109,9 @@ def test_LiteralIncludeReader_lines_and_lineno_match1(literal_inc_path):
109109

110110

111111
@pytest.mark.sphinx('html', testroot='root') # init locale for errors
112-
def test_LiteralIncludeReader_lines_and_lineno_match2(literal_inc_path, app):
112+
def test_LiteralIncludeReader_lines_and_lineno_match2(
113+
literal_inc_path: Path, app: SphinxTestApp
114+
) -> None:
113115
options = {'lines': '0,3,5', 'lineno-match': True}
114116
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
115117
with pytest.raises(
@@ -120,7 +122,9 @@ def test_LiteralIncludeReader_lines_and_lineno_match2(literal_inc_path, app):
120122

121123

122124
@pytest.mark.sphinx('html', testroot='root') # init locale for errors
123-
def test_LiteralIncludeReader_lines_and_lineno_match3(literal_inc_path, app):
125+
def test_LiteralIncludeReader_lines_and_lineno_match3(
126+
literal_inc_path: Path, app: SphinxTestApp
127+
) -> None:
124128
options = {'lines': '100-', 'lineno-match': True}
125129
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
126130
with pytest.raises(
@@ -130,23 +134,23 @@ def test_LiteralIncludeReader_lines_and_lineno_match3(literal_inc_path, app):
130134
reader.read()
131135

132136

133-
def test_LiteralIncludeReader_start_at(literal_inc_path):
137+
def test_LiteralIncludeReader_start_at(literal_inc_path: Path) -> None:
134138
options = {'lineno-match': True, 'start-at': 'Foo', 'end-at': 'Bar'}
135139
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
136140
content, _lines = reader.read()
137141
assert content == 'class Foo:\n pass\n\nclass Bar:\n'
138142
assert reader.lineno_start == 5
139143

140144

141-
def test_LiteralIncludeReader_start_after(literal_inc_path):
145+
def test_LiteralIncludeReader_start_after(literal_inc_path: Path) -> None:
142146
options = {'lineno-match': True, 'start-after': 'Foo', 'end-before': 'Bar'}
143147
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
144148
content, _lines = reader.read()
145149
assert content == ' pass\n\n'
146150
assert reader.lineno_start == 6
147151

148152

149-
def test_LiteralIncludeReader_start_after_and_lines(literal_inc_path):
153+
def test_LiteralIncludeReader_start_after_and_lines(literal_inc_path: Path) -> None:
150154
options = {
151155
'lineno-match': True,
152156
'lines': '6-',
@@ -159,15 +163,15 @@ def test_LiteralIncludeReader_start_after_and_lines(literal_inc_path):
159163
assert reader.lineno_start == 7
160164

161165

162-
def test_LiteralIncludeReader_start_at_and_lines(literal_inc_path):
166+
def test_LiteralIncludeReader_start_at_and_lines(literal_inc_path: Path) -> None:
163167
options = {'lines': '2, 3, 5', 'start-at': 'foo', 'end-before': '#'}
164168
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
165169
content, _lines = reader.read()
166170
assert content == '\nclass Foo:\n\n'
167171
assert reader.lineno_start == 1
168172

169173

170-
def test_LiteralIncludeReader_missing_start_and_end(literal_inc_path):
174+
def test_LiteralIncludeReader_missing_start_and_end(literal_inc_path: Path) -> None:
171175
options = {'start-at': 'NOTHING'}
172176
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
173177
with pytest.raises(ValueError, match='start-at pattern not found: NOTHING'):
@@ -189,14 +193,14 @@ def test_LiteralIncludeReader_missing_start_and_end(literal_inc_path):
189193
reader.read()
190194

191195

192-
def test_LiteralIncludeReader_end_before(literal_inc_path):
196+
def test_LiteralIncludeReader_end_before(literal_inc_path: Path) -> None:
193197
options = {'end-before': 'nclud'} # *nclud* matches first and third lines.
194198
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
195199
content, _lines = reader.read()
196200
assert content == '# Literally included file using Python highlighting\n\n'
197201

198202

199-
def test_LiteralIncludeReader_prepend(literal_inc_path):
203+
def test_LiteralIncludeReader_prepend(literal_inc_path: Path) -> None:
200204
options = {'lines': '1', 'prepend': 'Hello', 'append': 'Sphinx'}
201205
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
202206
content, _lines = reader.read()
@@ -205,7 +209,7 @@ def test_LiteralIncludeReader_prepend(literal_inc_path):
205209
)
206210

207211

208-
def test_LiteralIncludeReader_dedent(literal_inc_path):
212+
def test_LiteralIncludeReader_dedent(literal_inc_path: Path) -> None:
209213
# dedent: 2
210214
options = {'lines': '9-11', 'dedent': 2}
211215
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
@@ -231,7 +235,9 @@ def test_LiteralIncludeReader_dedent(literal_inc_path):
231235
assert content == 'def baz():\n pass\n\n'
232236

233237

234-
def test_LiteralIncludeReader_dedent_and_append_and_prepend(literal_inc_path):
238+
def test_LiteralIncludeReader_dedent_and_append_and_prepend(
239+
literal_inc_path: Path,
240+
) -> None:
235241
# dedent: 2
236242
options = {
237243
'lines': '9-11',

0 commit comments

Comments
 (0)