@@ -98,6 +98,24 @@ def test_tokenize_real_file(self) -> None:
9898 real_file = os .path .join (TESTS_DIR , "test_coverage.py" )
9999 self .check_file_tokenization (real_file )
100100
101+ def test_1828 (self ) -> None :
102+ # https://github.com/nedbat/coveragepy/pull/1828
103+ tokens = list (source_token_lines (textwrap .dedent ("""
104+ x = \
105+ 1
106+ a = ["aaa",\\
107+ "bbb \\
108+ ccc"]
109+ """ )))
110+ assert tokens == [
111+ [],
112+ [('nam' , 'x' ), ('ws' , ' ' ), ('op' , '=' ), ('ws' , ' ' ), ('num' , '1' )],
113+ [('nam' , 'a' ), ('ws' , ' ' ), ('op' , '=' ), ('ws' , ' ' ),
114+ ('op' , '[' ), ('str' , '"aaa"' ), ('op' , ',' ), ('xx' , '\\ ' )],
115+ [('ws' , ' ' ), ('str' , '"bbb \\ ' )],
116+ [('str' , ' ccc"' ), ('op' , ']' )],
117+ ]
118+
101119 @pytest .mark .parametrize ("fname" , [
102120 "stress_phystoken.tok" ,
103121 "stress_phystoken_dos.tok" ,
@@ -113,6 +131,7 @@ def test_stress(self, fname: str) -> None:
113131 with open (stress ) as fstress :
114132 assert re .search (r"(?m) $" , fstress .read ()), f"{ stress } needs a trailing space."
115133
134+
116135@pytest .mark .skipif (not env .PYBEHAVIOR .soft_keywords , reason = "Soft keywords are new in Python 3.10" )
117136class SoftKeywordTest (CoverageTest ):
118137 """Tests the tokenizer handling soft keywords."""
0 commit comments