Skip to content

Commit 9ce08b0

Browse files
authored
Merge pull request #118 from ev-br/ruff
MAINT: fix (some) style violations
2 parents 7dca61f + f1528aa commit 9ce08b0

File tree

8 files changed

+25
-17
lines changed

8 files changed

+25
-17
lines changed

scpdt/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77

88
__version__ = "0.1"
99

10-
from .impl import DTChecker, DTFinder, DTParser, DTRunner, DebugDTRunner, DTConfig
11-
from .frontend import testmod, testfile, find_doctests, run_docstring_examples
10+
from .impl import DTChecker, DTFinder, DTParser, DTRunner, DebugDTRunner, DTConfig # noqa
11+
from .frontend import testmod, testfile, find_doctests, run_docstring_examples # noqa
1212

scpdt/frontend.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,9 @@ def testmod(m=None, name=None, globs=None, verbose=None,
229229
runner = DTRunner(verbose=dtverbose, optionflags=flags, config=config)
230230

231231
### Find, parse, and run all tests in the given module.
232-
tests = find_doctests(m, strategy, name, exclude_empty, globs, extraglobs, config=config)
232+
tests = find_doctests(
233+
m, strategy, name, exclude_empty, globs, extraglobs, config=config
234+
)
233235

234236
for test in tests:
235237
if verbose == 1:
@@ -356,9 +358,13 @@ def testfile(filename, module_relative=True, name=None, package=None,
356358
# Fail fast or run all tests
357359
verbose, dtverbose = _map_verbosity(verbose)
358360
if raise_on_error:
359-
runner = DebugDTRunner(verbose=dtverbose, optionflags=optionflags, config=config)
361+
runner = DebugDTRunner(
362+
verbose=dtverbose, optionflags=optionflags, config=config
363+
)
360364
else:
361-
runner = DTRunner(verbose=dtverbose, optionflags=optionflags, config=config)
365+
runner = DTRunner(
366+
verbose=dtverbose, optionflags=optionflags, config=config
367+
)
362368

363369
### Parse doctest examples out of the input file and run them.
364370
if parser is None:

scpdt/impl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,9 @@ class DebugDTRunner(DTRunner):
386386
Almost verbatim copy of `doctest.DebugRunner`.
387387
"""
388388
def run(self, test, compileflags=None, out=None, clear_globs=True):
389-
r = super().run(test, compileflags=compileflags, out=out, clear_globs=clear_globs)
389+
r = super().run(
390+
test, compileflags=compileflags, out=out, clear_globs=clear_globs
391+
)
390392
if clear_globs:
391393
test.globs.clear()
392394
return r

scpdt/tests/module_cases.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
__all__ = ['func', 'func2', 'func3', 'func4', 'func5', 'func6', 'func8', 'func7', 'manip_printoptions', 'array_abbreviation']
1+
__all__ = [
2+
'func', 'func2', 'func3', 'func4', 'func5', 'func6', 'func8',
3+
'func7', 'manip_printoptions', 'array_abbreviation'
4+
]
25

36
def func():
47
"""

scpdt/tests/test_finder.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ def test_explicit_object_list_with_module():
156156

157157
def test_find_doctests_api():
158158
# Test that the module itself is included with strategy='api'
159-
objs = [finder_cases, finder_cases.Klass]
160159
tests = find_doctests(finder_cases, strategy='api')
161160

162161
base = 'scpdt.tests.finder_cases'

scpdt/tests/test_parser.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import doctest
2-
import pytest
3-
41
from ..impl import DTConfig, DTParser, DebugDTRunner
52

63

scpdt/tests/test_skipmarkers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66

77
class TestSyntaxErrors:
8-
"""Syntax errors trigger a doctest failure *unless* marked with +SKIP or as pseudocode.
8+
"""Syntax errors trigger a doctest failure *unless* marked.
9+
10+
Either mark it with +SKIP or as pseudocode.
911
"""
1012
def test_invalid_python(self):
1113
# This string raises

scpdt/tests/test_testmod.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import pytest
77

88
try:
9-
import scipy
9+
import scipy # noqa
1010
HAVE_SCIPY = True
11-
except:
11+
except Exception:
1212
HAVE_SCIPY = False
1313

1414
from . import (module_cases as module,
@@ -17,7 +17,7 @@
1717
failure_cases,
1818
failure_cases_2,
1919
local_file_cases)
20-
from ..frontend import testmod as _testmod, find_doctests, run_docstring_examples
20+
from ..frontend import testmod as _testmod, run_docstring_examples
2121
from ..util import warnings_errors
2222
from ..impl import DTConfig
2323

@@ -59,7 +59,6 @@ def test_run_docstring_examples():
5959

6060
def test_global_state():
6161
# Make sure doctesting does not alter the global state, as much as reasonable
62-
objs = [module.manip_printoptions]
6362
opts = np.get_printoptions()
6463
_testmod(module)
6564
new_opts = np.get_printoptions()
@@ -68,7 +67,7 @@ def test_global_state():
6867

6968
def test_module_debugrunner():
7069
with pytest.raises((doctest.UnexpectedException, doctest.DocTestFailure)):
71-
res = _testmod(failure_cases, raise_on_error=True)
70+
_testmod(failure_cases, raise_on_error=True)
7271

7372

7473
def test_verbosity_1():

0 commit comments

Comments
 (0)