def test_no_comma_required_multiline_if(self): comma_checker = CommaChecker( None, filename=get_absolute_path('data/multiline_if.py')) self.assertEqual( list( comma_checker.get_comma_errors( comma_checker.get_file_contents())), [])
def test_no_comma_required_dict_comprehension(self): comma_checker = CommaChecker( None, filename=get_absolute_path('data/dict_comprehension.py')) self.assertEqual( list( comma_checker.get_comma_errors( comma_checker.get_file_contents())), [])
def test_comma_good_dict(self): comma_checker = CommaChecker( None, filename=get_absolute_path('data/comment_good_dict.py')) self.assertEqual( list( comma_checker.get_comma_errors( comma_checker.get_file_contents())), [])
def test_bad_function_call(self): comma_checker = CommaChecker( None, filename=get_absolute_path('data/bad_function_call.py')) self.assertEqual( list( comma_checker.get_comma_errors( comma_checker.get_file_contents())), [ { 'col': 17, 'line': 3, 'message': 'C812 missing trailing comma' }, ])
def test_multiline_bad_dict(self): comma_checker = CommaChecker( None, filename=get_absolute_path('data/multiline_bad_dict.py')) self.assertEqual( list( comma_checker.get_comma_errors( comma_checker.get_file_contents())), [ { 'col': 14, 'line': 2, 'message': 'C812 missing trailing comma' }, ])
def test_no_comma_required_after_kwargs(self): comma_checker = CommaChecker(None, filename=get_absolute_path('data/kwargs.py')) self.assertEqual(list(comma_checker.get_comma_errors(comma_checker.get_file_contents())), [])
def test_no_comma_required_dict_comprehension(self): comma_checker = CommaChecker(None, filename=get_absolute_path('data/dict_comprehension.py')) self.assertEqual(list(comma_checker.get_comma_errors(comma_checker.get_file_contents())), [])
def test_comma_good_dict(self): comma_checker = CommaChecker(None, filename=get_absolute_path('data/comment_good_dict.py')) self.assertEqual(list(comma_checker.get_comma_errors(comma_checker.get_file_contents())), [])
def test_bad_function_call(self): comma_checker = CommaChecker(None, filename=get_absolute_path('data/bad_function_call.py')) self.assertEqual(list(comma_checker.get_comma_errors(comma_checker.get_file_contents())), [ {'col': 17, 'line': 3, 'message': 'C812 missing trailing comma'}, ])
def test_multiline_bad_dict(self): comma_checker = CommaChecker(None, filename=get_absolute_path('data/multiline_bad_dict.py')) self.assertEqual(list(comma_checker.get_comma_errors(comma_checker.get_file_contents())), [ {'col': 14, 'line': 2, 'message': 'C812 missing trailing comma'}, ])