Skip to content

Commit f8b424a

Browse files
committed
make doc a fixture
1 parent c76c3cf commit f8b424a

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

numpydoc/tests/test_docscrape.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,11 @@
134134
135135
'''
136136

137-
@pytest.fixture(params=['',''], ids=["flush", "newline_indented"])
137+
@pytest.fixture(params=['','\n '], ids=["flush", "newline_indented"])
138138
def doc(request):
139-
return NumpyDocString(doc_txt)
139+
return NumpyDocString(request.param+doc_txt)
140140

141141

142-
doc_firstline = NumpyDocString(doc_txt.lstrip())
143-
144142
doc_yields_txt = """
145143
Test generator
146144
@@ -180,12 +178,12 @@ def test_signature(doc):
180178
assert doc['Signature'].endswith('spam=None)')
181179

182180

183-
def test_summary():
181+
def test_summary(doc):
184182
assert doc['Summary'][0].startswith('Draw values')
185183
assert doc['Summary'][-1].endswith('covariance.')
186184

187185

188-
def test_extended_summary():
186+
def test_extended_summary(doc):
189187
assert doc['Extended Summary'][0].startswith('The multivariate normal')
190188

191189

@@ -349,23 +347,23 @@ def dummy_func(arg):
349347
or 'function dummy_func' in str(e))
350348

351349

352-
def test_notes():
350+
def test_notes(doc):
353351
assert doc['Notes'][0].startswith('Instead')
354352
assert doc['Notes'][-1].endswith('definite.')
355353
assert len(doc['Notes']) == 17
356354

357355

358-
def test_references():
356+
def test_references(doc):
359357
assert doc['References'][0].startswith('..')
360358
assert doc['References'][-1].endswith('2001.')
361359

362360

363-
def test_examples():
361+
def test_examples(doc):
364362
assert doc['Examples'][0].startswith('>>>')
365363
assert doc['Examples'][-1].endswith('True]')
366364

367365

368-
def test_index():
366+
def test_index(doc):
369367
assert doc['index']['default'] == 'random'
370368
assert len(doc['index']) == 2
371369
assert len(doc['index']['refguide']) == 2
@@ -389,7 +387,7 @@ def line_by_line_compare(a, b, n_lines=None):
389387
assert aa == bb
390388

391389

392-
def test_str():
390+
def test_str(doc):
393391
# doc_txt has the order of Notes and See Also sections flipped.
394392
# This should be handled automatically, and so, one thing this test does
395393
# is to make sure that See Also precedes Notes in the output.

0 commit comments

Comments
 (0)