(self)
| 161 | # Tests for specific bugs found in earlier versions of unparse |
| 162 | |
| 163 | def test_fstrings(self): |
| 164 | self.check_ast_roundtrip("f'a'") |
| 165 | self.check_ast_roundtrip("f'{{}}'") |
| 166 | self.check_ast_roundtrip("f'{{5}}'") |
| 167 | self.check_ast_roundtrip("f'{{5}}5'") |
| 168 | self.check_ast_roundtrip("f'X{{}}X'") |
| 169 | self.check_ast_roundtrip("f'{a}'") |
| 170 | self.check_ast_roundtrip("f'{ {1:2}}'") |
| 171 | self.check_ast_roundtrip("f'a{a}a'") |
| 172 | self.check_ast_roundtrip("f'a{a}{a}a'") |
| 173 | self.check_ast_roundtrip("f'a{a}a{a}a'") |
| 174 | self.check_ast_roundtrip("f'{a!r}x{a!s}12{{}}{a!a}'") |
| 175 | self.check_ast_roundtrip("f'{a:10}'") |
| 176 | self.check_ast_roundtrip("f'{a:100_000{10}}'") |
| 177 | self.check_ast_roundtrip("f'{a!r:10}'") |
| 178 | self.check_ast_roundtrip("f'{a:a{b}10}'") |
| 179 | self.check_ast_roundtrip( |
| 180 | "f'a{b}{c!s}{d!r}{e!a}{f:a}{g:a{b}}{h!s:a}" |
| 181 | "{j!s:{a}b}{k!s:a{b}c}{l!a:{b}c{d}}{x+y=}'" |
| 182 | ) |
| 183 | |
| 184 | def test_fstrings_special_chars(self): |
| 185 | # See issue 25180 |
nothing calls this directly
no test coverage detected