OLD | NEW |
1 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) | 1 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions | 4 # modification, are permitted provided that the following conditions |
5 # are met: | 5 # are met: |
6 # 1. Redistributions of source code must retain the above copyright | 6 # 1. Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # 2. Redistributions in binary form must reproduce the above copyright | 8 # 2. Redistributions in binary form must reproduce the above copyright |
9 # notice, this list of conditions and the following disclaimer in the | 9 # notice, this list of conditions and the following disclaimer in the |
10 # documentation and/or other materials provided with the distribution. | 10 # documentation and/or other materials provided with the distribution. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 def _mock_handle_style_error(line_number, category, confidence, | 50 def _mock_handle_style_error(line_number, category, confidence, |
51 message): | 51 message): |
52 error = (line_number, category, confidence, message) | 52 error = (line_number, category, confidence, message) |
53 errors.append(error) | 53 errors.append(error) |
54 | 54 |
55 current_dir = os.path.dirname(__file__) | 55 current_dir = os.path.dirname(__file__) |
56 file_path = os.path.join(current_dir, "python_unittest_input.py") | 56 file_path = os.path.join(current_dir, "python_unittest_input.py") |
57 | 57 |
58 checker = PythonChecker(file_path, _mock_handle_style_error) | 58 checker = PythonChecker(file_path, _mock_handle_style_error) |
59 checker.check(lines=[]) | 59 checker.check() |
60 | 60 |
61 self.assertEqual(errors, [ | 61 self.assertEqual( |
62 (4, "pep8/W291", 5, "trailing whitespace"), | 62 [ |
63 (4, "pylint/E1601(print-statement)", 5, "[] print statement used"), | 63 (2, 'pep8/W291', 5, 'trailing whitespace'), |
64 (4, "pylint/E0602(undefined-variable)", 5, "[] Undefined variable 'e
rror'"), | 64 (3, 'pep8/E261', 5, 'at least two spaces before inline comment')
, |
65 ]) | 65 (3, 'pep8/E262', 5, "inline comment should start with '# '"), |
| 66 (2, 'pylint/C0303(trailing-whitespace)', 5, '[] Trailing whitesp
ace'), |
| 67 (2, 'pylint/E1601(print-statement)', 5, '[] print statement used
'), |
| 68 (2, 'pylint/E0602(undefined-variable)', 5, u"[] Undefined variab
le 'error'"), |
| 69 (3, 'pylint/W0611(unused-import)', 5, '[] Unused import math'), |
| 70 ], |
| 71 errors) |
OLD | NEW |