src/numdifftools/testing.py
Unable to import 'numpy' Open
Open
import numpy as np
- Read upRead up
- Exclude checks
Used when pylint has been unable to import a module.
Line break after binary operator Open
Open
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE |
- Read upRead up
- Exclude checks
Avoid breaks after binary operators.
The preferred place to break around a binary operator is before the
operator, not after it.
W504: (width == 0 +\n height == 0)
W504: (width == 0 and\n height == 0)
W504: var = (1 &\n ~2)
Okay: foo(\n -x)
Okay: foo(x\n [])
Okay: x = '''\n''' + ''
Okay: x = '' + '''\n'''
Okay: foo(x,\n -y)
Okay: foo(x, # comment\n -y)
The following should be W504 but unary_context is tricky with these
Okay: var = (1 /\n -2)
Okay: var = (1 +\n -1 +\n -2)
Formatting a regular string which could be a f-string Open
Open
print('Testing docstrings in {}'.format(name))
- Read upRead up
- Exclude checks
Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use of f-strings is preferred. Requires Python 3.6 and py-version >= 3.6
.
Import outside toplevel (doctest) Open
Open
import doctest
- Read upRead up
- Exclude checks
Used when an import statement is used anywhere other than the module toplevel. Move this import to the top of the file.
Missing function or method docstring Open
Open
def test_docstrings(name=''):
- Read upRead up
- Exclude checks
Used when a function or method has no docstring. Some special methods like init do not require a docstring.