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

Method test_triple_quoted

Lib/test/test_tstring.py:268–288  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

266 eval(case)
267
268 def test_triple_quoted(self):
269 # Test triple-quoted t-strings
270 t = t"""
271 Hello,
272 world
273 """
274 self.assertTStringEqual(
275 t, ("\n Hello,\n world\n ",), ()
276 )
277 self.assertEqual(fstring(t), "\n Hello,\n world\n ")
278
279 # Test triple-quoted with interpolation
280 name = "Python"
281 t = t"""
282 Hello,
283 {name}
284 """
285 self.assertTStringEqual(
286 t, ("\n Hello,\n ", "\n "), [(name, "name")]
287 )
288 self.assertEqual(fstring(t), "\n Hello,\n Python\n ")
289
290if __name__ == '__main__':
291 unittest.main()

Callers

nothing calls this directly

Calls 3

fstringFunction · 0.90
assertTStringEqualMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected