Skip to content

Commit 0958ef9

Browse files
authored
MAINT: clean-up unused objects (#254)
* F401: Add pytest.main() or clean-up unused import * F811: remove second identical 'test_returnyield' function * F821: 'tags' is a special object from sphinx-build; mark with noqa * F841: clean-up unused local variables
1 parent f884309 commit 0958ef9

File tree

4 files changed

+10
-29
lines changed

4 files changed

+10
-29
lines changed

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
html_theme = 'scipy'
138138
html_theme_path = [themedir]
139139

140-
if 'scipyorg' in tags:
140+
if 'scipyorg' in tags: # noqa: F821
141141
# Build for the scipy.org website
142142
html_theme_options = {
143143
"edit_link": True,

numpydoc/docscrape.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,6 @@ def __str__(self):
595595
out = ''
596596

597597
func, func_name = self.get_func()
598-
signature = self['Signature'].replace('*', r'\*')
599598

600599
roles = {'func': 'function',
601600
'meth': 'method'}

numpydoc/tests/test_docscrape.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from collections import namedtuple
33
from copy import deepcopy
44
import re
5-
import sys
65
import textwrap
76
import warnings
87

@@ -264,26 +263,6 @@ def test_returnyield():
264263
assert_raises(ValueError, NumpyDocString, doc_text)
265264

266265

267-
def test_returnyield():
268-
doc_text = """
269-
Test having returns and yields.
270-
271-
Returns
272-
-------
273-
int
274-
The number of apples.
275-
276-
Yields
277-
------
278-
a : int
279-
The number of apples.
280-
b : int
281-
The number of bananas.
282-
283-
"""
284-
assert_raises(ValueError, NumpyDocString, doc_text)
285-
286-
287266
def test_section_twice():
288267
doc_text = """
289268
Test having a section Notes twice
@@ -859,7 +838,7 @@ class Dummy(object):
859838
def test_see_also_trailing_comma_warning():
860839
warnings.filterwarnings('error')
861840
with assert_warns(Warning, match='Unexpected comma or period after function list at index 43 of line .*'):
862-
doc6 = NumpyDocString(
841+
NumpyDocString(
863842
"""
864843
z(x,theta)
865844

numpydoc/tests/test_numpydoc.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,28 @@ def test_mangle_docstrings():
4242
.. autoclass:: str
4343
'''
4444
lines = s.split('\n')
45-
doc = mangle_docstrings(MockApp(), 'class', 'str', str, {}, lines)
45+
mangle_docstrings(MockApp(), 'class', 'str', str, {}, lines)
4646
assert 'rpartition' in [x.strip() for x in lines]
4747

4848
lines = s.split('\n')
49-
doc = mangle_docstrings(MockApp(), 'class', 'str', str, {'members': ['upper']}, lines)
49+
mangle_docstrings(
50+
MockApp(), 'class', 'str', str, {'members': ['upper']}, lines)
5051
assert 'rpartition' not in [x.strip() for x in lines]
5152
assert 'upper' in [x.strip() for x in lines]
5253

5354
lines = s.split('\n')
54-
doc = mangle_docstrings(MockApp(), 'class', 'str', str, {'exclude-members': ALL}, lines)
55+
mangle_docstrings(
56+
MockApp(), 'class', 'str', str, {'exclude-members': ALL}, lines)
5557
assert 'rpartition' not in [x.strip() for x in lines]
5658
assert 'upper' not in [x.strip() for x in lines]
5759

5860
lines = s.split('\n')
59-
doc = mangle_docstrings(MockApp(), 'class', 'str', str,
60-
{'exclude-members': ['upper']}, lines)
61+
mangle_docstrings(
62+
MockApp(), 'class', 'str', str, {'exclude-members': ['upper']}, lines)
6163
assert 'rpartition' in [x.strip() for x in lines]
6264
assert 'upper' not in [x.strip() for x in lines]
6365

6466

6567
if __name__ == "__main__":
6668
import pytest
69+
pytest.main()

0 commit comments

Comments
 (0)