From 51469947cde995eea4c0eb5723fa57f5762fd217 Mon Sep 17 00:00:00 2001 From: Anshul Hudda Date: Wed, 6 Nov 2019 09:13:02 +0530 Subject: [PATCH 1/4] Added lint check for newline above args --- scripts/pylint_extensions.py | 66 +++++++++++++- scripts/pylint_extensions_test.py | 140 ++++++++++++++++++++++++++++++ 2 files changed, 204 insertions(+), 2 deletions(-) diff --git a/scripts/pylint_extensions.py b/scripts/pylint_extensions.py index 35267d8e57bc..5627b9f85c9a 100644 --- a/scripts/pylint_extensions.py +++ b/scripts/pylint_extensions.py @@ -639,7 +639,6 @@ def check_single_constructor_params(self, class_doc, init_doc, class_node): """Checks whether a class and corresponding init() method are documented. If both of them are documented, it adds an error message. - Args: class_doc: Docstring. Pylint docstring class instance representing a class's docstring. @@ -658,6 +657,7 @@ def check_single_constructor_params(self, class_doc, init_doc, class_node): def _handle_no_raise_doc(self, excs, node): """Checks whether the raised exception in a function has been documented, add a message otherwise. + Args: excs: list(str). A list of exception types. node: astroid.scoped_nodes.Function. Node to access module content. @@ -1010,7 +1010,6 @@ def process_module(self, node): if file_content[line_num] == b'\n': blank_line_counter += 1 - else: blank_line_counter = 0 @@ -1020,6 +1019,68 @@ def process_module(self, node): self.add_message('excessive-new-lines', line=line_num + 1) +class SingleNewlineAboveArgsChecker(checkers.BaseChecker): + """Checker for single space above args in python doc string.""" + + __implements__ = interfaces.IRawChecker + name = 'single-space-above-args' + priority = -1 + msgs = { + 'C0012': ( + 'Files must have a single newline above args in doc string.', + 'single-space-above-args', + 'Please enter a single newline above doc string.' + ) + } + + def process_module(self, node): + """Process a module to ensure that there is a single newline above args + in python doc string. + + Args: + node: astroid.scoped_nodes.Function. Node to access module content. + """ + + in_multi_line_comment = False + multi_line_indicator = b'"""' + file_content = read_from_node(node) + file_length = len(file_content) + blank_line_counter = 0 + + for line_num in python_utils.RANGE(file_length): + line = file_content[line_num].strip() + + # Single multi-line comment, ignore it. + if line.count(multi_line_indicator) == 2: + continue + + # Flip multi-line boolean depending on whether or not we see + # the multi-line indicator. Possible for multiline comment to + # be somewhere other than the start of a line (e.g. func arg), + # so we can't look at start of or end of a line, which is why + # the case where two indicators in a single line is handled + # separately (i.e. one line comment with multi-line strings). + if multi_line_indicator in line: + in_multi_line_comment = not in_multi_line_comment + + # Ignore anything inside a multi-line comment. + if in_multi_line_comment: + continue + + if file_content[line_num] == b'\n': + blank_line_counter += 1 + else: + blank_line_counter = 0 + + if (line_num + 1 < file_length and ( + blank_line_counter == 0 or blank_line_counter > 1)): + line = file_content[line_num + 1].strip() + if (len(line.split()) == 1 and + re.match(br'^[A-Z][a-z]+[:]', line)): + self.add_message( + 'single-space-above-args', line=line_num + 1) + + def register(linter): """Registers the checker with pylint. @@ -1036,3 +1097,4 @@ def register(linter): linter.register_checker(SingleCharAndNewlineAtEOFChecker(linter)) linter.register_checker(SingleSpaceAfterYieldChecker(linter)) linter.register_checker(ExcessiveEmptyLinesChecker(linter)) + linter.register_checker(SingleNewlineAboveArgsChecker(linter)) diff --git a/scripts/pylint_extensions_test.py b/scripts/pylint_extensions_test.py index fcfa104f0a71..be23cc8fde9b 100644 --- a/scripts/pylint_extensions_test.py +++ b/scripts/pylint_extensions_test.py @@ -1143,3 +1143,143 @@ def func3(): with checker_test_object.assertNoMessages(): temp_file.close() + + +class SingleNewlineAboveArgsCheckerTests(unittest.TestCase): + + def test_checks_newline_above_docstring(self): + checker_test_object = testutils.CheckerTestCase() + checker_test_object.CHECKER_CLASS = ( + pylint_extensions.SingleNewlineAboveArgsChecker) + checker_test_object.setup_method() + node_single_newline_above_args = astroid.scoped_nodes.Module( + name='test', + doc='Custom test') + temp_file = tempfile.NamedTemporaryFile() + filename = temp_file.name + + with python_utils.open_file(filename, 'w') as tmp: + tmp.write( + u"""def func(arg): + '''Returns something. + Args: + arg: argument + Returns: + returns_something + ''' + + return returns_something + """) + node_single_newline_above_args.file = filename + node_single_newline_above_args.path = filename + + checker_test_object.checker.process_module( + node_single_newline_above_args) + + with checker_test_object.assertAddsMessages( + testutils.Message( + msg_id='single-space-above-args', + line=2 + ), + testutils.Message( + msg_id='single-space-above-args', + line=4 + ), + ): + temp_file.close() + + node_with_two_newline = astroid.scoped_nodes.Module( + name='test', + doc='Custom test') + + temp_file = tempfile.NamedTemporaryFile() + filename = temp_file.name + with python_utils.open_file(filename, 'w') as tmp: + tmp.write( + u"""def func(arg): + '''Returns something. + + + Args: + arg: argument + + + Returns: + returns_something + ''' + returns something + """) + node_with_two_newline.file = filename + node_with_two_newline.path = filename + + checker_test_object.checker.process_module( + node_with_two_newline) + + with checker_test_object.assertAddsMessages( + testutils.Message( + msg_id='single-space-above-args', + line=4 + ), + testutils.Message( + msg_id='single-space-above-args', + line=8 + ), + ): + temp_file.close() + + node_with_return_in_comment = astroid.scoped_nodes.Module( + name='test', + doc='Custom test') + temp_file = tempfile.NamedTemporaryFile() + filename = temp_file.name + + with python_utils.open_file(filename, 'w') as tmp: + tmp.write( + u"""def func(arg): + '''Returns something. + + Args: + arg: argument + + Returns: + returns_something + ''' + "Returns: something" + returns_something + """) + node_with_return_in_comment.file = filename + node_with_return_in_comment.path = filename + + checker_test_object.checker.process_module( + node_with_return_in_comment) + + with checker_test_object.assertNoMessages(): + temp_file.close() + + node_with_no_error_message = astroid.scoped_nodes.Module( + name='test', + doc='Custom test') + + temp_file = tempfile.NamedTemporaryFile() + filename = temp_file.name + with python_utils.open_file(filename, 'w') as tmp: + tmp.write( + u"""def func(arg): + '''Returns something. + + Args: + arg: argument + + Returns: + returns_something + ''' + + returns_something + """) + node_with_no_error_message.file = filename + node_with_no_error_message.path = filename + + checker_test_object.checker.process_module(node_with_no_error_message) + + with checker_test_object.assertNoMessages(): + temp_file.close() From 83a2d38cbed840265d61ab4bfc45aa5345a78e6f Mon Sep 17 00:00:00 2001 From: Anshul Hudda Date: Wed, 6 Nov 2019 11:55:26 +0530 Subject: [PATCH 2/4] Added more tests --- scripts/pylint_extensions.py | 21 ++++++-- scripts/pylint_extensions_test.py | 88 +++++++++++++++++++++++++++++-- 2 files changed, 103 insertions(+), 6 deletions(-) diff --git a/scripts/pylint_extensions.py b/scripts/pylint_extensions.py index 5627b9f85c9a..d0eb7e9f1baf 100644 --- a/scripts/pylint_extensions.py +++ b/scripts/pylint_extensions.py @@ -1029,7 +1029,17 @@ class SingleNewlineAboveArgsChecker(checkers.BaseChecker): 'C0012': ( 'Files must have a single newline above args in doc string.', 'single-space-above-args', - 'Please enter a single newline above doc string.' + 'Please enter a single newline above args in doc string.' + ), + 'C0013': ( + 'Files must have a single newline above returns in doc string.', + 'single-space-above-returns', + 'Please enter a single newline above returns in doc string.' + ), + 'C0014': ( + 'Files must have a single newline above raises in doc string.', + 'single-space-above-raises', + 'Please enter a single newline above raises in doc string.' ) } @@ -1075,10 +1085,15 @@ def process_module(self, node): if (line_num + 1 < file_length and ( blank_line_counter == 0 or blank_line_counter > 1)): line = file_content[line_num + 1].strip() - if (len(line.split()) == 1 and - re.match(br'^[A-Z][a-z]+[:]', line)): + if line == b'Args:': self.add_message( 'single-space-above-args', line=line_num + 1) + elif line == b'Returns:': + self.add_message( + 'single-space-above-returns', line=line_num + 1) + elif line == b'Raises:': + self.add_message( + 'single-space-above-raises', line=line_num + 1) def register(linter): diff --git a/scripts/pylint_extensions_test.py b/scripts/pylint_extensions_test.py index be23cc8fde9b..640d9aea06f2 100644 --- a/scripts/pylint_extensions_test.py +++ b/scripts/pylint_extensions_test.py @@ -1182,7 +1182,7 @@ def test_checks_newline_above_docstring(self): line=2 ), testutils.Message( - msg_id='single-space-above-args', + msg_id='single-space-above-returns', line=4 ), ): @@ -1221,12 +1221,70 @@ def test_checks_newline_above_docstring(self): line=4 ), testutils.Message( - msg_id='single-space-above-args', + msg_id='single-space-above-returns', line=8 ), ): temp_file.close() + node_with_no_space_above_return = astroid.scoped_nodes.Module( + name='test', + doc='Custom test') + temp_file = tempfile.NamedTemporaryFile() + filename = temp_file.name + + with python_utils.open_file(filename, 'w') as tmp: + tmp.write( + u"""def func(): + '''Returns something. + Returns: + returns_something + ''' + returns_something + """) + node_with_no_space_above_return.file = filename + node_with_no_space_above_return.path = filename + + checker_test_object.checker.process_module( + node_with_no_space_above_return) + + with checker_test_object.assertAddsMessages( + testutils.Message( + msg_id='single-space-above-returns', + line=2 + ), + ): + temp_file.close() + + node_with_no_space_above_raises = astroid.scoped_nodes.Module( + name='test', + doc='Custom test') + temp_file = tempfile.NamedTemporaryFile() + filename = temp_file.name + + with python_utils.open_file(filename, 'w') as tmp: + tmp.write( + u"""def func(): + '''Raises exception. + Raises: + raises_exception + ''' + raises_exception + """) + node_with_no_space_above_raises.file = filename + node_with_no_space_above_raises.path = filename + + checker_test_object.checker.process_module( + node_with_no_space_above_raises) + + with checker_test_object.assertAddsMessages( + testutils.Message( + msg_id='single-space-above-raises', + line=2 + ), + ): + temp_file.close() + node_with_return_in_comment = astroid.scoped_nodes.Module( name='test', doc='Custom test') @@ -1256,6 +1314,27 @@ def test_checks_newline_above_docstring(self): with checker_test_object.assertNoMessages(): temp_file.close() + node_with_no_args = astroid.scoped_nodes.Module( + name='test', + doc='Custom test') + temp_file = tempfile.NamedTemporaryFile() + filename = temp_file.name + with python_utils.open_file(filename, 'w') as tmp: + tmp.write( + u"""def func(): + '''Do something.''' + + do something + """) + node_with_no_args.file = filename + node_with_no_args.path = filename + + checker_test_object.checker.process_module( + node_with_no_args) + + with checker_test_object.assertNoMessages(): + temp_file.close() + node_with_no_error_message = astroid.scoped_nodes.Module( name='test', doc='Custom test') @@ -1272,8 +1351,11 @@ def test_checks_newline_above_docstring(self): Returns: returns_something - ''' + Raises: + raises something + ''' + raises_something returns_something """) node_with_no_error_message.file = filename From 484c110dab422244c3d79de7c5e19bd84514ecb9 Mon Sep 17 00:00:00 2001 From: Anshul Hudda Date: Thu, 7 Nov 2019 10:58:50 +0530 Subject: [PATCH 3/4] Added lint check for newline above args --- scripts/pylint_extensions.py | 6 +- scripts/pylint_extensions_test.py | 167 +++++++++++++++++++++++------- 2 files changed, 133 insertions(+), 40 deletions(-) diff --git a/scripts/pylint_extensions.py b/scripts/pylint_extensions.py index d0eb7e9f1baf..b01724b47955 100644 --- a/scripts/pylint_extensions.py +++ b/scripts/pylint_extensions.py @@ -1023,7 +1023,7 @@ class SingleNewlineAboveArgsChecker(checkers.BaseChecker): """Checker for single space above args in python doc string.""" __implements__ = interfaces.IRawChecker - name = 'single-space-above-args' + name = 'single-space-above-args-raises-returns' priority = -1 msgs = { 'C0012': ( @@ -1044,8 +1044,8 @@ class SingleNewlineAboveArgsChecker(checkers.BaseChecker): } def process_module(self, node): - """Process a module to ensure that there is a single newline above args - in python doc string. + """Process a module to ensure that there is a single newline above args, + raises, returns in python doc string. Args: node: astroid.scoped_nodes.Function. Node to access module content. diff --git a/scripts/pylint_extensions_test.py b/scripts/pylint_extensions_test.py index 640d9aea06f2..7901011d156d 100644 --- a/scripts/pylint_extensions_test.py +++ b/scripts/pylint_extensions_test.py @@ -1161,14 +1161,11 @@ def test_checks_newline_above_docstring(self): with python_utils.open_file(filename, 'w') as tmp: tmp.write( u"""def func(arg): - '''Returns something. + '''Do something. Args: arg: argument - Returns: - returns_something ''' - - return returns_something + do something """) node_single_newline_above_args.file = filename node_single_newline_above_args.path = filename @@ -1181,48 +1178,34 @@ def test_checks_newline_above_docstring(self): msg_id='single-space-above-args', line=2 ), - testutils.Message( - msg_id='single-space-above-returns', - line=4 - ), ): temp_file.close() - node_with_two_newline = astroid.scoped_nodes.Module( + node_single_newline_above_raises = astroid.scoped_nodes.Module( name='test', doc='Custom test') - temp_file = tempfile.NamedTemporaryFile() filename = temp_file.name + with python_utils.open_file(filename, 'w') as tmp: tmp.write( - u"""def func(arg): - '''Returns something. - - - Args: - arg: argument - - - Returns: - returns_something + u"""def func(): + '''Raises exception. + Raises: + raises_exception ''' - returns something + raises_exception """) - node_with_two_newline.file = filename - node_with_two_newline.path = filename + node_single_newline_above_raises.file = filename + node_single_newline_above_raises.path = filename checker_test_object.checker.process_module( - node_with_two_newline) + node_single_newline_above_raises) with checker_test_object.assertAddsMessages( testutils.Message( - msg_id='single-space-above-args', - line=4 - ), - testutils.Message( - msg_id='single-space-above-returns', - line=8 + msg_id='single-space-above-raises', + line=2 ), ): temp_file.close() @@ -1256,7 +1239,7 @@ def test_checks_newline_above_docstring(self): ): temp_file.close() - node_with_no_space_above_raises = astroid.scoped_nodes.Module( + node_newline_above_args_raises = astroid.scoped_nodes.Module( name='test', doc='Custom test') temp_file = tempfile.NamedTemporaryFile() @@ -1264,23 +1247,133 @@ def test_checks_newline_above_docstring(self): with python_utils.open_file(filename, 'w') as tmp: tmp.write( - u"""def func(): + u"""def func(arg): '''Raises exception. + + Args: + arg: argument + Raises: + raises_something + ''' + raises_exception + """) + node_newline_above_args_raises.file = filename + node_newline_above_args_raises.path = filename + + checker_test_object.checker.process_module( + node_newline_above_args_raises) + + with checker_test_object.assertAddsMessages( + testutils.Message( + msg_id='single-space-above-raises', + line=5 + ), + ): + temp_file.close() + + node_newline_above_args_returns = astroid.scoped_nodes.Module( + name='test', + doc='Custom test') + temp_file = tempfile.NamedTemporaryFile() + filename = temp_file.name + + with python_utils.open_file(filename, 'w') as tmp: + tmp.write( + u"""def func(arg): + '''Returns Something. + + Args: + arg: argument + Returns: + returns_something + ''' + returns_something + """) + node_newline_above_args_returns.file = filename + node_newline_above_args_returns.path = filename + + checker_test_object.checker.process_module( + node_newline_above_args_returns) + + with checker_test_object.assertAddsMessages( + testutils.Message( + msg_id='single-space-above-returns', + line=5 + ), + ): + temp_file.close() + + node_newline_above_returns_raises = astroid.scoped_nodes.Module( + name='test', + doc='Custom test') + temp_file = tempfile.NamedTemporaryFile() + filename = temp_file.name + + with python_utils.open_file(filename, 'w') as tmp: + tmp.write( + u"""def func(): + '''Do something. + + + Raises: raises_exception + + Returns: + returns_something ''' raises_exception + returns_something """) - node_with_no_space_above_raises.file = filename - node_with_no_space_above_raises.path = filename + node_newline_above_returns_raises.file = filename + node_newline_above_returns_raises.path = filename checker_test_object.checker.process_module( - node_with_no_space_above_raises) + node_newline_above_returns_raises) with checker_test_object.assertAddsMessages( testutils.Message( msg_id='single-space-above-raises', - line=2 + line=5 + ), + ): + temp_file.close() + + node_with_two_newline = astroid.scoped_nodes.Module( + name='test', + doc='Custom test') + + temp_file = tempfile.NamedTemporaryFile() + filename = temp_file.name + with python_utils.open_file(filename, 'w') as tmp: + tmp.write( + u"""def func(arg): + '''Returns something. + + + Args: + arg: argument + + + Returns: + returns_something + ''' + returns something + """) + node_with_two_newline.file = filename + node_with_two_newline.path = filename + + checker_test_object.checker.process_module( + node_with_two_newline) + + with checker_test_object.assertAddsMessages( + testutils.Message( + msg_id='single-space-above-args', + line=4 + ), + testutils.Message( + msg_id='single-space-above-returns', + line=8 ), ): temp_file.close() From fbb4dba59c8940b8e9b438b68eecd9766a2d4fa5 Mon Sep 17 00:00:00 2001 From: Anshul Hudda Date: Mon, 11 Nov 2019 21:31:52 +0530 Subject: [PATCH 4/4] Split test in modules --- scripts/pylint_extensions_test.py | 59 ++++++++++++++++++------------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/scripts/pylint_extensions_test.py b/scripts/pylint_extensions_test.py index 7901011d156d..5f1d8da3444a 100644 --- a/scripts/pylint_extensions_test.py +++ b/scripts/pylint_extensions_test.py @@ -1147,11 +1147,14 @@ def func3(): class SingleNewlineAboveArgsCheckerTests(unittest.TestCase): - def test_checks_newline_above_docstring(self): - checker_test_object = testutils.CheckerTestCase() - checker_test_object.CHECKER_CLASS = ( + def setUp(self): + super(SingleNewlineAboveArgsCheckerTests, self).setUp() + self.checker_test_object = testutils.CheckerTestCase() + self.checker_test_object.CHECKER_CLASS = ( pylint_extensions.SingleNewlineAboveArgsChecker) - checker_test_object.setup_method() + self.checker_test_object.setup_method() + + def test_no_newline_above_args(self): node_single_newline_above_args = astroid.scoped_nodes.Module( name='test', doc='Custom test') @@ -1170,10 +1173,10 @@ def test_checks_newline_above_docstring(self): node_single_newline_above_args.file = filename node_single_newline_above_args.path = filename - checker_test_object.checker.process_module( + self.checker_test_object.checker.process_module( node_single_newline_above_args) - with checker_test_object.assertAddsMessages( + with self.checker_test_object.assertAddsMessages( testutils.Message( msg_id='single-space-above-args', line=2 @@ -1181,6 +1184,7 @@ def test_checks_newline_above_docstring(self): ): temp_file.close() + def test_no_newline_above_raises(self): node_single_newline_above_raises = astroid.scoped_nodes.Module( name='test', doc='Custom test') @@ -1199,10 +1203,10 @@ def test_checks_newline_above_docstring(self): node_single_newline_above_raises.file = filename node_single_newline_above_raises.path = filename - checker_test_object.checker.process_module( + self.checker_test_object.checker.process_module( node_single_newline_above_raises) - with checker_test_object.assertAddsMessages( + with self.checker_test_object.assertAddsMessages( testutils.Message( msg_id='single-space-above-raises', line=2 @@ -1210,6 +1214,7 @@ def test_checks_newline_above_docstring(self): ): temp_file.close() + def test_no_newline_above_return(self): node_with_no_space_above_return = astroid.scoped_nodes.Module( name='test', doc='Custom test') @@ -1228,10 +1233,10 @@ def test_checks_newline_above_docstring(self): node_with_no_space_above_return.file = filename node_with_no_space_above_return.path = filename - checker_test_object.checker.process_module( + self.checker_test_object.checker.process_module( node_with_no_space_above_return) - with checker_test_object.assertAddsMessages( + with self.checker_test_object.assertAddsMessages( testutils.Message( msg_id='single-space-above-returns', line=2 @@ -1239,6 +1244,7 @@ def test_checks_newline_above_docstring(self): ): temp_file.close() + def test_varying_combination_of_newline_above_args(self): node_newline_above_args_raises = astroid.scoped_nodes.Module( name='test', doc='Custom test') @@ -1260,10 +1266,10 @@ def test_checks_newline_above_docstring(self): node_newline_above_args_raises.file = filename node_newline_above_args_raises.path = filename - checker_test_object.checker.process_module( + self.checker_test_object.checker.process_module( node_newline_above_args_raises) - with checker_test_object.assertAddsMessages( + with self.checker_test_object.assertAddsMessages( testutils.Message( msg_id='single-space-above-raises', line=5 @@ -1292,10 +1298,10 @@ def test_checks_newline_above_docstring(self): node_newline_above_args_returns.file = filename node_newline_above_args_returns.path = filename - checker_test_object.checker.process_module( + self.checker_test_object.checker.process_module( node_newline_above_args_returns) - with checker_test_object.assertAddsMessages( + with self.checker_test_object.assertAddsMessages( testutils.Message( msg_id='single-space-above-returns', line=5 @@ -1328,10 +1334,10 @@ def test_checks_newline_above_docstring(self): node_newline_above_returns_raises.file = filename node_newline_above_returns_raises.path = filename - checker_test_object.checker.process_module( + self.checker_test_object.checker.process_module( node_newline_above_returns_raises) - with checker_test_object.assertAddsMessages( + with self.checker_test_object.assertAddsMessages( testutils.Message( msg_id='single-space-above-raises', line=5 @@ -1339,6 +1345,7 @@ def test_checks_newline_above_docstring(self): ): temp_file.close() + def test_excessive_newline_above_args(self): node_with_two_newline = astroid.scoped_nodes.Module( name='test', doc='Custom test') @@ -1363,10 +1370,10 @@ def test_checks_newline_above_docstring(self): node_with_two_newline.file = filename node_with_two_newline.path = filename - checker_test_object.checker.process_module( + self.checker_test_object.checker.process_module( node_with_two_newline) - with checker_test_object.assertAddsMessages( + with self.checker_test_object.assertAddsMessages( testutils.Message( msg_id='single-space-above-args', line=4 @@ -1378,6 +1385,7 @@ def test_checks_newline_above_docstring(self): ): temp_file.close() + def test_return_in_comment(self): node_with_return_in_comment = astroid.scoped_nodes.Module( name='test', doc='Custom test') @@ -1401,12 +1409,13 @@ def test_checks_newline_above_docstring(self): node_with_return_in_comment.file = filename node_with_return_in_comment.path = filename - checker_test_object.checker.process_module( + self.checker_test_object.checker.process_module( node_with_return_in_comment) - with checker_test_object.assertNoMessages(): + with self.checker_test_object.assertNoMessages(): temp_file.close() + def test_function_with_no_args(self): node_with_no_args = astroid.scoped_nodes.Module( name='test', doc='Custom test') @@ -1422,12 +1431,13 @@ def test_checks_newline_above_docstring(self): node_with_no_args.file = filename node_with_no_args.path = filename - checker_test_object.checker.process_module( + self.checker_test_object.checker.process_module( node_with_no_args) - with checker_test_object.assertNoMessages(): + with self.checker_test_object.assertNoMessages(): temp_file.close() + def test_well_placed_newline(self): node_with_no_error_message = astroid.scoped_nodes.Module( name='test', doc='Custom test') @@ -1454,7 +1464,8 @@ def test_checks_newline_above_docstring(self): node_with_no_error_message.file = filename node_with_no_error_message.path = filename - checker_test_object.checker.process_module(node_with_no_error_message) + self.checker_test_object.checker.process_module( + node_with_no_error_message) - with checker_test_object.assertNoMessages(): + with self.checker_test_object.assertNoMessages(): temp_file.close()