@@ -36,6 +36,7 @@ def inner(confidence: Confidence = HIGH) -> Message:
36
36
37
37
38
38
def test_output_line () -> None :
39
+ """Test that the OutputLine NamedTuple is instantiated correctly."""
39
40
output_line = OutputLine (
40
41
symbol = "missing-docstring" ,
41
42
lineno = 1 ,
@@ -45,16 +46,30 @@ def test_output_line() -> None:
45
46
confidence = HIGH .name ,
46
47
)
47
48
assert output_line .symbol == "missing-docstring"
49
+ assert output_line .lineno == 1
50
+ assert output_line .column == 2
51
+ assert output_line .object == ""
52
+ assert output_line .msg == "Missing docstring's bad."
53
+ assert output_line .confidence == "HIGH"
48
54
49
55
50
56
def test_output_line_from_message (message : Callable ) -> None :
57
+ """Test that the OutputLine NamedTuple is instantiated correctly with from_msg."""
58
+ expected_column = 2 if PY38_PLUS else 0
51
59
output_line = OutputLine .from_msg (message ())
52
60
assert output_line .symbol == "missing-docstring"
61
+ assert output_line .lineno == 1
62
+ assert output_line .column == expected_column
63
+ assert output_line .object == "obj"
53
64
assert output_line .msg == "msg"
65
+ assert output_line .confidence == "HIGH"
54
66
55
67
56
68
@pytest .mark .parametrize ("confidence" , [HIGH , INFERENCE ])
57
69
def test_output_line_to_csv (confidence : Confidence , message : Callable ) -> None :
70
+ """Test that the OutputLine NamedTuple is instantiated correctly with from_msg
71
+ and then converted to csv.
72
+ """
58
73
output_line = OutputLine .from_msg (message (confidence ))
59
74
csv = output_line .to_csv ()
60
75
expected_column = "2" if PY38_PLUS else "0"
@@ -69,6 +84,7 @@ def test_output_line_to_csv(confidence: Confidence, message: Callable) -> None:
69
84
70
85
71
86
def test_output_line_from_csv_error () -> None :
87
+ """Test that errors are correctly raised for incorrect OutputLine's."""
72
88
with pytest .raises (
73
89
MalformedOutputLineException ,
74
90
match = "msg-symbolic-name:42:27:MyClass.my_function:The message" ,
@@ -87,6 +103,7 @@ def test_output_line_from_csv_error() -> None:
87
103
def test_output_line_from_csv (
88
104
confidence : Optional [str ], expected_confidence : str
89
105
) -> None :
106
+ """Test that the OutputLine NamedTuple is instantiated correctly with from_csv."""
90
107
if confidence :
91
108
proper_csv = [
92
109
"missing-docstring" ,
0 commit comments