summaryrefslogtreecommitdiff
path: root/tests/testutils
diff options
context:
space:
mode:
authorDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2021-11-24 16:52:24 +0100
committerGitHub <noreply@github.com>2021-11-24 16:52:24 +0100
commitbe149db10f756301a6f18c245fa799d7beec6648 (patch)
tree696a0591b57f0913c8831f49c600dcbb76bb43d1 /tests/testutils
parentc056248a458330b1813c144310fbc5d4bb82a3d9 (diff)
downloadpylint-git-be149db10f756301a6f18c245fa799d7beec6648.tar.gz
Update functional test expected output (#5349)
* Add ``confidence`` to all expected functional test outputs * Make OutputLine accept end_line and end_column Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Diffstat (limited to 'tests/testutils')
-rw-r--r--tests/testutils/test_output_line.py56
1 files changed, 52 insertions, 4 deletions
diff --git a/tests/testutils/test_output_line.py b/tests/testutils/test_output_line.py
index 928083508..25f784a54 100644
--- a/tests/testutils/test_output_line.py
+++ b/tests/testutils/test_output_line.py
@@ -36,6 +36,8 @@ def test_output_line() -> None:
symbol="missing-docstring",
lineno=1,
column=2,
+ end_lineno=1,
+ end_column=4,
object="",
msg="Missing docstring's bad.",
confidence=HIGH.name,
@@ -43,6 +45,8 @@ def test_output_line() -> None:
assert output_line.symbol == "missing-docstring"
assert output_line.lineno == 1
assert output_line.column == 2
+ assert output_line.end_lineno == 1
+ assert output_line.end_column == 4
assert output_line.object == ""
assert output_line.msg == "Missing docstring's bad."
assert output_line.confidence == "HIGH"
@@ -51,10 +55,14 @@ def test_output_line() -> None:
def test_output_line_from_message(message: Callable) -> None:
"""Test that the OutputLine NamedTuple is instantiated correctly with from_msg."""
expected_column = 2 if PY38_PLUS else 0
+ expected_end_lineno = 1 if PY38_PLUS else None
+ expected_end_column = 3 if PY38_PLUS else None
output_line = OutputLine.from_msg(message())
assert output_line.symbol == "missing-docstring"
assert output_line.lineno == 1
assert output_line.column == expected_column
+ assert output_line.end_lineno == expected_end_lineno
+ assert output_line.end_column == expected_end_column
assert output_line.object == "obj"
assert output_line.msg == "msg"
assert output_line.confidence == "HIGH"
@@ -68,10 +76,14 @@ 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 = "2" if PY38_PLUS else "0"
+ expected_end_lineno = "1" if PY38_PLUS else "None"
+ expected_end_column = "3" if PY38_PLUS else "None"
assert csv == (
"missing-docstring",
"1",
expected_column,
+ expected_end_lineno,
+ expected_end_column,
"obj",
"msg",
confidence.name,
@@ -93,12 +105,14 @@ def test_output_line_from_csv_error() -> None:
@pytest.mark.parametrize(
- "confidence,expected_confidence", [[None, "HIGH"], ["INFERENCE", "INFERENCE"]]
+ "confidence,expected_confidence", [[None, "UNDEFINED"], ["INFERENCE", "INFERENCE"]]
)
-def test_output_line_from_csv(
+def test_output_line_from_csv_deprecated(
confidence: Optional[str], expected_confidence: str
) -> None:
- """Test that the OutputLine NamedTuple is instantiated correctly with from_csv."""
+ """Test that the OutputLine NamedTuple is instantiated correctly with from_csv.
+ Test OutputLine's of length 5 or 6.
+ """
if confidence:
proper_csv = [
"missing-docstring",
@@ -110,13 +124,47 @@ def test_output_line_from_csv(
]
else:
proper_csv = ["missing-docstring", "1", "2", "obj", "msg"]
- output_line = OutputLine.from_csv(proper_csv)
+ with pytest.warns(DeprecationWarning) as records:
+ output_line = OutputLine.from_csv(proper_csv)
+ assert len(records) == 1
+
expected_column = 2 if PY38_PLUS else 0
assert output_line == OutputLine(
symbol="missing-docstring",
lineno=1,
column=expected_column,
+ end_lineno=None,
+ end_column=None,
object="obj",
msg="msg",
confidence=expected_confidence,
)
+
+
+def test_output_line_from_csv() -> None:
+ """Test that the OutputLine NamedTuple is instantiated correctly with from_csv.
+ Test OutputLine of length 8.
+ """
+ proper_csv = [
+ "missing-docstring",
+ "1",
+ "2",
+ "1",
+ "None",
+ "obj",
+ "msg",
+ "HIGH",
+ ]
+ output_line = OutputLine.from_csv(proper_csv)
+ expected_column = 2 if PY38_PLUS else 0
+ expected_end_lineno = 1 if PY38_PLUS else None
+ assert output_line == OutputLine(
+ symbol="missing-docstring",
+ lineno=1,
+ column=expected_column,
+ end_lineno=expected_end_lineno,
+ end_column=None,
+ object="obj",
+ msg="msg",
+ confidence="HIGH",
+ )