From ec0a6fa165deaea126afc6d5f0ebe3f7dea3d8f7 Mon Sep 17 00:00:00 2001 From: Kenichi Maehashi Date: Thu, 20 Jan 2022 13:31:26 +0000 Subject: [PATCH] fix test to pass in Python 3.10 --- tests/test_flake8_force.py | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/tests/test_flake8_force.py b/tests/test_flake8_force.py index c156a31..e6c3bb4 100644 --- a/tests/test_flake8_force.py +++ b/tests/test_flake8_force.py @@ -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():