summaryrefslogtreecommitdiff
path: root/tests/testutils
diff options
context:
space:
mode:
authorDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2021-09-24 00:27:33 +0200
committerGitHub <noreply@github.com>2021-09-24 00:27:33 +0200
commit5124f5409f9d3e540318ece0f7899da4bf04dad2 (patch)
tree07c7e651121bf65c08d432887a3f1167d0db4396 /tests/testutils
parent9dc186f3aa68560c205e06b4759fb80b12a72c36 (diff)
downloadpylint-git-5124f5409f9d3e540318ece0f7899da4bf04dad2.tar.gz
Refactor and typing of OutputLine (#5060)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Diffstat (limited to 'tests/testutils')
-rw-r--r--tests/testutils/test_output_line.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/tests/testutils/test_output_line.py b/tests/testutils/test_output_line.py
index e4afa9e33..46135dd20 100644
--- a/tests/testutils/test_output_line.py
+++ b/tests/testutils/test_output_line.py
@@ -3,7 +3,7 @@
# pylint: disable=redefined-outer-name
-from typing import Callable, List, Optional
+from typing import Callable, Optional
import pytest
@@ -11,6 +11,7 @@ from pylint.constants import PY38_PLUS
from pylint.interfaces import HIGH, INFERENCE, Confidence
from pylint.message import Message
from pylint.testutils.output_line import MalformedOutputLineException, OutputLine
+from pylint.typing import MessageLocationTuple
@pytest.fixture()
@@ -19,14 +20,14 @@ def message() -> Callable:
return Message(
symbol="missing-docstring",
msg_id="C0123",
- location=[ # type: ignore
+ location=MessageLocationTuple(
"abspath",
"path",
"module",
"obj",
- "line",
- "column",
- ],
+ 1,
+ 2,
+ ),
msg="msg",
confidence=confidence,
)
@@ -37,11 +38,11 @@ def message() -> Callable:
def test_output_line() -> None:
output_line = OutputLine(
symbol="missing-docstring",
- lineno=0,
- column="0",
+ lineno=1,
+ column=2,
object="",
msg="Missing docstring's bad.",
- confidence=HIGH,
+ confidence=HIGH.name,
)
assert output_line.symbol == "missing-docstring"
@@ -56,10 +57,10 @@ def test_output_line_from_message(message: Callable) -> None:
def test_output_line_to_csv(confidence: Confidence, message: Callable) -> None:
output_line = OutputLine.from_msg(message(confidence))
csv = output_line.to_csv()
- expected_column = "column" if PY38_PLUS else ""
+ expected_column = "2" if PY38_PLUS else "0"
assert csv == (
"missing-docstring",
- "line",
+ "1",
expected_column,
"obj",
"msg",
@@ -84,10 +85,10 @@ def test_output_line_from_csv_error() -> None:
"confidence,expected_confidence", [[None, "HIGH"], ["INFERENCE", "INFERENCE"]]
)
def test_output_line_from_csv(
- confidence: Optional[str], expected_confidence: Confidence
+ confidence: Optional[str], expected_confidence: str
) -> None:
if confidence:
- proper_csv: List[str] = [
+ proper_csv = [
"missing-docstring",
"1",
"2",
@@ -98,7 +99,7 @@ def test_output_line_from_csv(
else:
proper_csv = ["missing-docstring", "1", "2", "obj", "msg"]
output_line = OutputLine.from_csv(proper_csv)
- expected_column = "2" if PY38_PLUS else ""
+ expected_column = 2 if PY38_PLUS else 0
assert output_line == OutputLine(
symbol="missing-docstring",
lineno=1,