Shorten docstring for warn_about_none_ast

This commit is contained in:
Tomer Keren 2018-12-05 17:47:34 +02:00
parent 41031fce2f
commit 7a7ad0c120
1 changed files with 4 additions and 10 deletions

View File

@ -878,16 +878,10 @@ class AssertionRewriter(ast.NodeVisitor):
return self.statements
def warn_about_none_ast(self, node, module_path, lineno):
"""Returns an ast warning if node is None with the following statement:
if node is None:
from _pytest.warning_types import PytestWarning
import warnings
warnings.warn_explicit(
PytestWarning('assertion the value None, Please use "assert is None"'),
category=None,
filename=str,
lineno=node.lineno,
)
"""
Returns an ast issuing a warning if the value of node is `None`
This is used to warn the user when asserting a function that asserts internally.
See issue #3191 for more details
"""
# using parse because it's different between py2 py3