@@ -62,38 +62,38 @@ def test_extract() -> None:
6262 po_check .set_check ("extract" , True )
6363 result = po_check .check_files ([local_path ("fr.po" )])
6464 assert len (result ) == 1
65- assert "fr.po" in result [0 ][ 0 ]
66- assert len (result [0 ][ 1 ] ) == 3
65+ assert "fr.po" in result [0 ]. filename
66+ assert len (result [0 ]) == 3
6767
68- report = result [0 ][1 ][ 0 ]
68+ report = result [0 ][0 ]
6969 assert report .message == "Ceci est un test.\n "
7070 assert report .idmsg == "extract"
7171 assert report .filename == "-"
7272 assert report .line == 0
7373 assert report .mid == ""
7474 assert report .mstr == ""
7575 assert report .fuzzy is False
76- assert str ( report ) == "Ceci est un test.\n \n ---"
76+ assert report . to_string ( ) == "Ceci est un test.\n \n ---"
7777
78- report = result [0 ][1 ][ 1 ]
78+ report = result [0 ][1 ]
7979 assert report .message == "Test sur deux lignes.\n Ligne 2."
8080 assert report .idmsg == "extract"
8181 assert report .filename == "-"
8282 assert report .line == 0
8383 assert report .mid == ""
8484 assert report .mstr == ""
8585 assert report .fuzzy is False
86- assert str ( report ) == "Test sur deux lignes.\n Ligne 2.\n ---"
86+ assert report . to_string ( ) == "Test sur deux lignes.\n Ligne 2.\n ---"
8787
88- report = result [0 ][1 ][ 2 ]
88+ report = result [0 ][2 ]
8989 assert report .message == " erreur : %s" # noqa: RUF001
9090 assert report .idmsg == "extract"
9191 assert report .filename == "-"
9292 assert report .line == 0
9393 assert report .mid == ""
9494 assert report .mstr == ""
9595 assert report .fuzzy is False
96- assert str ( report ) == " erreur : %s\n ---" # noqa: RUF001
96+ assert report . to_string ( ) == " erreur : %s\n ---" # noqa: RUF001
9797
9898
9999def test_checks () -> None :
@@ -105,24 +105,24 @@ def test_checks() -> None:
105105 assert len (result ) == 2
106106
107107 # first file has no errors
108- assert not result [0 ][ 1 ]
108+ assert not result [0 ]
109109
110110 # second file has 10 errors
111- assert len (result [1 ][ 1 ] ) == 9
111+ assert len (result [1 ]) == 9
112112
113113 # check first error
114- report = result [1 ][1 ][ 0 ]
114+ report = result [1 ][0 ]
115115 assert report .message == "number of lines: 2 in string, 1 in translation"
116116 assert report .idmsg == "lines"
117117 assert "fr_errors.po" in report .filename
118118 assert report .line == 44
119119 assert report .mid == "Test 1 on two lines.\n Line 2."
120120 assert report .mstr == "Test 1 sur deux lignes."
121121 assert report .fuzzy is False
122- assert "fr_errors.po:44: [lines] number of lines: 2 in string, 1 in translation" in str ( report )
122+ assert "fr_errors.po:44: [lines] number of lines: 2 in string, 1 in translation" in report . to_string ( )
123123
124124 # check last error
125- report = result [1 ][1 ][ 8 ]
125+ report = result [1 ][8 ]
126126 expected = "different whitespace at end of a line: 1 in string, 0 in translation"
127127 assert report .message == expected
128128 assert report .idmsg == "whitespace_eol"
@@ -133,8 +133,8 @@ def test_checks() -> None:
133133 assert report .fuzzy is False
134134
135135 # check number of errors by type
136- errors = {}
137- for report in result [1 ][ 1 ] :
136+ errors : dict [ str , int ] = {}
137+ for report in result [1 ]:
138138 errors [report .idmsg ] = errors .get (report .idmsg , 0 ) + 1
139139 assert errors ["lines" ] == 2
140140 assert errors ["punct" ] == 1
@@ -152,7 +152,7 @@ def test_checks_fuzzy() -> None:
152152 assert len (result ) == 1
153153
154154 # the file has 11 errors (with the fuzzy string)
155- assert len (result [0 ][ 1 ] ) == 10
155+ assert len (result [0 ]) == 10
156156
157157
158158def test_checks_noqa () -> None :
@@ -165,7 +165,7 @@ def test_checks_noqa() -> None:
165165 assert len (result ) == 1
166166
167167 # the file has 10 errors (including `noqa`-commented lines)
168- assert len (result [0 ][ 1 ] ) == 10
168+ assert len (result [0 ]) == 10
169169
170170
171171def test_replace_fmt_c () -> None :
@@ -238,7 +238,7 @@ def test_spelling_id() -> None:
238238 assert len (result ) == 1
239239
240240 # the file has 2 spelling errors: "Thsi" and "errro"
241- report = result [0 ][ 1 ]
241+ report = result [0 ]
242242 assert len (report ) == 3
243243 for i , word in enumerate (("Thsi" , "testtwo" , "errro" )):
244244 assert report [i ].idmsg == "spelling-id"
@@ -262,7 +262,7 @@ def test_spelling_id_multilpe_pwl() -> None:
262262 assert len (result ) == 1
263263
264264 # the file has 2 spelling errors: "Thsi" and "errro"
265- report = result [0 ][ 1 ]
265+ report = result [0 ]
266266 assert len (report ) == 2
267267 for i , word in enumerate (("Thsi" , "errro" )):
268268 assert report [i ].idmsg == "spelling-id"
@@ -283,7 +283,7 @@ def test_spelling_str() -> None:
283283 assert len (result ) == 2
284284
285285 # first file has 3 spelling errors: "CecX", "aabbcc" and "xxyyzz"
286- report = result [0 ][ 1 ]
286+ report = result [0 ]
287287 assert len (report ) == 4
288288 for i , word in enumerate (("testtwo" , "CecX" , "aabbcc" , "xxyyzz" )):
289289 assert report [i ].idmsg == "spelling-str"
@@ -293,7 +293,7 @@ def test_spelling_str() -> None:
293293 assert report [i ].get_misspelled_words () == [word ]
294294
295295 # second file has 1 error: dict/language "xyz" not found
296- report = result [1 ][ 1 ]
296+ report = result [1 ]
297297 assert len (report ) == 1
298298 assert report [0 ].idmsg == "dict"
299299
@@ -312,7 +312,7 @@ def test_spelling_str_multiple_pwl() -> None:
312312 assert len (result ) == 2
313313
314314 # first file has 3 spelling errors: "CecX", "aabbcc" and "xxyyzz"
315- report = result [0 ][ 1 ]
315+ report = result [0 ]
316316 assert len (report ) == 3
317317 for i , word in enumerate (("CecX" , "aabbcc" , "xxyyzz" )):
318318 assert report [i ].idmsg == "spelling-str"
@@ -322,7 +322,7 @@ def test_spelling_str_multiple_pwl() -> None:
322322 assert report [i ].get_misspelled_words () == [word ]
323323
324324 # second file has 1 error: dict/language "xyz" not found
325- report = result [1 ][ 1 ]
325+ report = result [1 ]
326326 assert len (report ) == 1
327327 assert report [0 ].idmsg == "dict"
328328
@@ -416,4 +416,4 @@ def test_invalid_utf8() -> None:
416416 assert len (result ) == 1
417417
418418 # the file has no errors
419- assert len (result [0 ][ 1 ] ) == 0
419+ assert len (result [0 ]) == 0
0 commit comments