@@ -70,13 +70,33 @@ def test_output_line_from_message(message: _MessageCallable) -> None:
7070 assert output_line .msg == "msg"
7171 assert output_line .confidence == "HIGH"
7272
73+ output_line_with_end = OutputLine .from_msg (message (), True )
74+ assert output_line_with_end .symbol == "missing-docstring"
75+ assert output_line_with_end .lineno == 1
76+ assert output_line_with_end .column == 2
77+ assert output_line_with_end .end_lineno == 1
78+ assert output_line_with_end .end_column == 3
79+ assert output_line_with_end .object == "obj"
80+ assert output_line_with_end .msg == "msg"
81+ assert output_line_with_end .confidence == "HIGH"
82+
83+ output_line_without_end = OutputLine .from_msg (message (), False )
84+ assert output_line_without_end .symbol == "missing-docstring"
85+ assert output_line_without_end .lineno == 1
86+ assert output_line_without_end .column == 2
87+ assert output_line_without_end .end_lineno is None
88+ assert output_line_without_end .end_column is None
89+ assert output_line_without_end .object == "obj"
90+ assert output_line_without_end .msg == "msg"
91+ assert output_line_without_end .confidence == "HIGH"
92+
7393
7494@pytest .mark .parametrize ("confidence" , [HIGH , INFERENCE ])
7595def test_output_line_to_csv (confidence : Confidence , message : _MessageCallable ) -> None :
7696 """Test that the OutputLine NamedTuple is instantiated correctly with from_msg
7797 and then converted to csv.
7898 """
79- output_line = OutputLine .from_msg (message (confidence ))
99+ output_line = OutputLine .from_msg (message (confidence ), True )
80100 csv = output_line .to_csv ()
81101 assert csv == (
82102 "missing-docstring" ,
@@ -89,6 +109,19 @@ def test_output_line_to_csv(confidence: Confidence, message: _MessageCallable) -
89109 confidence .name ,
90110 )
91111
112+ output_line_without_end = OutputLine .from_msg (message (confidence ), False )
113+ csv = output_line_without_end .to_csv ()
114+ assert csv == (
115+ "missing-docstring" ,
116+ "1" ,
117+ "2" ,
118+ "None" ,
119+ "None" ,
120+ "obj" ,
121+ "msg" ,
122+ confidence .name ,
123+ )
124+
92125
93126def test_output_line_from_csv () -> None :
94127 """Test that the OutputLine NamedTuple is instantiated correctly with from_csv.
@@ -107,3 +140,25 @@ def test_output_line_from_csv() -> None:
107140 msg = "msg" ,
108141 confidence = "HIGH" ,
109142 )
143+ output_line_with_end = OutputLine .from_csv (proper_csv , True )
144+ assert output_line_with_end == OutputLine (
145+ symbol = "missing-docstring" ,
146+ lineno = 1 ,
147+ column = 2 ,
148+ end_lineno = 1 ,
149+ end_column = None ,
150+ object = "obj" ,
151+ msg = "msg" ,
152+ confidence = "HIGH" ,
153+ )
154+ output_line_without_end = OutputLine .from_csv (proper_csv , False )
155+ assert output_line_without_end == OutputLine (
156+ symbol = "missing-docstring" ,
157+ lineno = 1 ,
158+ column = 2 ,
159+ end_lineno = None ,
160+ end_column = None ,
161+ object = "obj" ,
162+ msg = "msg" ,
163+ confidence = "HIGH" ,
164+ )
0 commit comments