@@ -1203,6 +1203,36 @@ def test_bug_1828(self) -> None:
1203
1203
'3 ccc"]' ,
1204
1204
]
1205
1205
1206
+ @pytest .mark .parametrize (
1207
+ "leader" , ["" , "f" , "r" , "fr" , "rf" ],
1208
+ ids = ["string" , "f-string" , "raw_string" , "f-raw_string" , "raw_f-string" ]
1209
+ )
1210
+ def test_bug_1836 (self , leader : str ) -> None :
1211
+ # https://github.com/nedbat/coveragepy/issues/1836
1212
+ self .make_file ("py312_fstrings.py" , f"""\
1213
+ prog_name = 'bug.py'
1214
+ err_msg = { leader } '''\\
1215
+ {{prog_name}}: ERROR: This is the first line of the error.
1216
+ {{prog_name}}: ERROR: This is the second line of the error.
1217
+ \\
1218
+ {{prog_name}}: ERROR: This is the third line of the error.
1219
+ '''
1220
+ """ )
1221
+
1222
+ cov = coverage .Coverage ()
1223
+ py312_fstrings = self .start_import_stop (cov , "py312_fstrings" )
1224
+ cov .html_report (py312_fstrings )
1225
+
1226
+ assert self .get_html_report_text_lines ("py312_fstrings.py" ) == [
1227
+ "1" + "prog_name = 'bug.py'" ,
1228
+ "2" + f"err_msg = { leader } '''\\ " ,
1229
+ "3" + "{prog_name}: ERROR: This is the first line of the error." ,
1230
+ "4" + "{prog_name}: ERROR: This is the second line of the error." ,
1231
+ "5" + "\\ " ,
1232
+ "6" + "{prog_name}: ERROR: This is the third line of the error." ,
1233
+ "7" + "'''" ,
1234
+ ]
1235
+
1206
1236
def test_unicode (self ) -> None :
1207
1237
surrogate = "\U000e0100 "
1208
1238
0 commit comments