예제 #1
0
    def test_should_skip_invalid_lines(self):
        parsed = _parse(failed_flake8_with_invalid_lines)

        self.assertEqual(
            parsed, {
                "tests/subject/__init__.py": [
                    {
                        "file": "tests/subject/__init__.py",
                        "line": "1",
                        "col": "1",
                        "detail": "F401 'os' imported but unused",
                        "code": "F401"
                    },
                    {
                        "file": "tests/subject/__init__.py",
                        "line": "3",
                        "col": "1",
                        "detail": "E302 expected 2 blank lines, found 1",
                        "code": "E302"
                    },
                ],
                "tests/subject/example.py": [
                    {
                        "file": "tests/subject/example.py",
                        "line": "4",
                        "col": "1",
                        "detail": "E302 expected 2 blank lines, found 1",
                        "code": "E302"
                    },
                ]
            })
예제 #2
0
    def test_should_skip_invalid_lines(self):
        parsed = _parse(failed_flake8_with_invalid_lines)

        self.assertEqual(parsed, {
            "tests/subject/__init__.py": [
                {"file": "tests/subject/__init__.py", "line": "1", "col": "1", "detail": "F401 'os' imported but unused", "code": "F401"},
                {"file": "tests/subject/__init__.py", "line": "3", "col": "1", "detail": "E302 expected 2 blank lines, found 1", "code": "E302"},
            ],
            "tests/subject/example.py": [
                {"file": "tests/subject/example.py", "line": "4", "col": "1", "detail": "E302 expected 2 blank lines, found 1", "code": "E302"},
            ]
        })
예제 #3
0
    def test_should_parse_a_flake8_file_with_errors(self):
        parsed = _parse(failed_flake8)

        self.assertEqual(parsed, {
            "tests/subject/__init__.py": [
                {"file": "tests/subject/__init__.py", "line": "1", "col": "1", "detail": "F401 'os' imported but unused", "code": "F401"},
                {"file": "tests/subject/__init__.py", "line": "3", "col": "1", "detail": "E302 expected 2 blank lines, found 1", "code": "E302"},
            ],
            "tests/subject/example.py": [
                {"file": "tests/subject/example.py", "line": "4", "col": "1", "detail": "E302 expected 2 blank lines, found 1", "code": "E302"},
                {"file": "tests/subject/example.py", "line": "16", "col": "22", "detail": "E203 whitespace before ':'", "code": "E203"},
            ]
        })
예제 #4
0
    def test_should_parse_a_flake8_file_with_errors(self):
        parsed = _parse(failed_flake8)

        self.assertEqual(
            parsed, {
                "tests/subject/__init__.py": [
                    {
                        "file": "tests/subject/__init__.py",
                        "line": "1",
                        "col": "1",
                        "detail": "F401 'os' imported but unused",
                        "code": "F401"
                    },
                    {
                        "file": "tests/subject/__init__.py",
                        "line": "3",
                        "col": "1",
                        "detail": "E302 expected 2 blank lines, found 1",
                        "code": "E302"
                    },
                ],
                "tests/subject/example.py": [
                    {
                        "file": "tests/subject/example.py",
                        "line": "4",
                        "col": "1",
                        "detail": "E302 expected 2 blank lines, found 1",
                        "code": "E302"
                    },
                    {
                        "file": "tests/subject/example.py",
                        "line": "16",
                        "col": "22",
                        "detail": "E203 whitespace before ':'",
                        "code": "E203"
                    },
                ]
            })
예제 #5
0
 def test_should_return_an_empty_dict_when_parsing_a_flake8_success_file(
         self):
     self.assertEqual({}, _parse(valid_flake8))
예제 #6
0
 def test_should_return_an_empty_dict_when_parsing_a_flake8_success_file(self):
     self.assertEqual({}, _parse(valid_flake8))