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

Method test_basic_creation

Lib/test/test_string/test_templatelib.py:29–46  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

27 class Sub(Interpolation): ...
28
29 def test_basic_creation(self):
30 # Simple t-string creation
31 t = t'Hello, world'
32 self.assertIsInstance(t, Template)
33 self.assertTStringEqual(t, ('Hello, world',), ())
34 self.assertEqual(fstring(t), 'Hello, world')
35
36 # Empty t-string
37 t = t''
38 self.assertTStringEqual(t, ('',), ())
39 self.assertEqual(fstring(t), '')
40
41 # Multi-line t-string
42 t = t"""Hello,
43world"""
44 self.assertEqual(t.strings, ('Hello,\nworld',))
45 self.assertEqual(len(t.interpolations), 0)
46 self.assertEqual(fstring(t), 'Hello,\nworld')
47
48 def test_interpolation_creation(self):
49 i = Interpolation('Maria', 'name', 'a', 'fmt')

Callers

nothing calls this directly

Calls 4

fstringFunction · 0.90
assertIsInstanceMethod · 0.80
assertTStringEqualMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected