Address code review
This commit is contained in:
parent
e1e4b226c6
commit
41031fce2f
|
@ -10,7 +10,8 @@ When they should write::
|
||||||
|
|
||||||
Because the ``assert_called_with`` method of mock objects already executes an assertion.
|
Because the ``assert_called_with`` method of mock objects already executes an assertion.
|
||||||
|
|
||||||
This warning will not be issued when ``None`` is explicitly checked
|
This warning will not be issued when ``None`` is explicitly checked. An assertion like::
|
||||||
assert none_returning_fun() is None
|
|
||||||
|
assert variable is None
|
||||||
|
|
||||||
will not issue the warning
|
will not issue the warning
|
||||||
|
|
|
@ -885,8 +885,7 @@ class AssertionRewriter(ast.NodeVisitor):
|
||||||
warnings.warn_explicit(
|
warnings.warn_explicit(
|
||||||
PytestWarning('assertion the value None, Please use "assert is None"'),
|
PytestWarning('assertion the value None, Please use "assert is None"'),
|
||||||
category=None,
|
category=None,
|
||||||
# filename=str(self.module_path),
|
filename=str,
|
||||||
filename=__file__
|
|
||||||
lineno=node.lineno,
|
lineno=node.lineno,
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
|
@ -905,7 +904,7 @@ warn_explicit(
|
||||||
lineno={lineno},
|
lineno={lineno},
|
||||||
)
|
)
|
||||||
""".format(
|
""".format(
|
||||||
filename=str(module_path), lineno=lineno
|
filename=module_path.strpath, lineno=lineno
|
||||||
)
|
)
|
||||||
).body
|
).body
|
||||||
return ast.If(val_is_none, send_warning, [])
|
return ast.If(val_is_none, send_warning, [])
|
||||||
|
|
Loading…
Reference in New Issue