Skip to content

Commit

Permalink
fix test to pass in Python 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
kmaehashi committed Jan 20, 2022
1 parent 206802e commit ec0a6fa
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions tests/test_flake8_force.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,33 @@ def test_fail():


def test_token():
assert _flake8("token.py") == [
(1, 1, "E999", "SyntaxError: unexpected EOF while parsing"),
]
assert _flake8("token.py", force=True) == [
(1, 1, "E999", "SyntaxError: unexpected EOF while parsing"),
(2, 1, "E902", "TokenError: EOF in multi-line statement"),
]
results = _flake8("token.py")
assert len(results) == 1
assert results[0][0] == 1
assert results[0][2] == "E999"
assert "SyntaxError" in results[0][3]

results_force = _flake8("token.py", force=True)
assert len(results_force) == 2
assert results_force[0] == results[0]
assert results_force[1][0] == 2
assert results_force[1][2] == "E902"
assert "TokenError" in results_force[1][3]


def test_indent():
assert _flake8("indent.py") == [
(4, 4, "E999", "IndentationError: unexpected indent"),
]
assert _flake8("indent.py", force=True) == [
(4, 4, "E999", "IndentationError: unexpected indent"),
(4, 5, "E113", "unexpected indentation"),
]
results = _flake8("indent.py")
assert len(results) == 1
assert results[0][0] == 4
assert results[0][2] == "E999"
assert "IndentationError" in results[0][3]

results_force = _flake8("indent.py", force=True)
assert len(results_force) == 2
assert results_force[0] == results[0]
assert results_force[1][0] == 4
assert results_force[1][2] == "E113"
assert "unexpected indentation" in results_force[1][3]


def test_cython_valid():
Expand Down

0 comments on commit ec0a6fa

Please sign in to comment.