예제 #1
0
 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())), [])
예제 #2
0
 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())), [])
예제 #3
0
 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())), [])
예제 #4
0
 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'
                     },
                 ])
예제 #5
0
 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'
                     },
                 ])
예제 #6
0
 def test_get_noqa_lines(self):
     checker = CommaChecker(None, filename=get_absolute_path('data/no_qa.py'))
     self.assertEqual(checker.get_noqa_lines(checker.get_file_contents()), [2])
예제 #7
0
 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())), [])
예제 #8
0
 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())), [])
예제 #9
0
 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())), [])
예제 #10
0
 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'},
     ])
예제 #11
0
 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'},
     ])
예제 #12
0
 def test_get_noqa_lines(self):
     checker = CommaChecker(None,
                            filename=get_absolute_path('data/no_qa.py'))
     self.assertEqual(checker.get_noqa_lines(checker.get_file_contents()),
                      [2])