MCPcopy Index your code
hub / github.com/python/cpython / test_tstrings

Method test_tstrings

Lib/test/test_unparse.py:205–218  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

203 self.check_ast_roundtrip('f"{f"{f"{f"{f"{f"{1+1}"}"}"}"}"}"')
204
205 def test_tstrings(self):
206 self.check_ast_roundtrip("t'foo'")
207 self.check_ast_roundtrip("t'foo {bar}'")
208 self.check_ast_roundtrip("t'foo {bar!s:.2f}'")
209 self.check_ast_roundtrip("t'{a + b}'")
210 self.check_ast_roundtrip("t'{a + b:x}'")
211 self.check_ast_roundtrip("t'{a + b!s}'")
212 self.check_ast_roundtrip("t'{ {a}}'")
213 self.check_ast_roundtrip("t'{ {a}=}'")
214 self.check_ast_roundtrip("t'{{a}}'")
215 self.check_ast_roundtrip("t''")
216 self.check_ast_roundtrip('t""')
217 self.check_ast_roundtrip("t'{(lambda x: x)}'")
218 self.check_ast_roundtrip("t'{t'{x}'}'")
219
220 def test_tstring_with_nonsensical_str_field(self):
221 # `value` suggests that the original code is `t'{test1}`, but `str` suggests otherwise

Callers

nothing calls this directly

Calls 1

check_ast_roundtripMethod · 0.80

Tested by

no test coverage detected