mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
gh-132661: Add default value (of "") for Interpolation.expression (#136441)
This commit is contained in:
parent
f519918ec6
commit
f1b8d01c80
5 changed files with 58 additions and 27 deletions
|
|
@ -45,6 +45,19 @@ def test_basic_creation(self):
|
|||
self.assertEqual(len(t.interpolations), 0)
|
||||
self.assertEqual(fstring(t), 'Hello,\nworld')
|
||||
|
||||
def test_interpolation_creation(self):
|
||||
i = Interpolation('Maria', 'name', 'a', 'fmt')
|
||||
self.assertInterpolationEqual(i, ('Maria', 'name', 'a', 'fmt'))
|
||||
|
||||
i = Interpolation('Maria', 'name', 'a')
|
||||
self.assertInterpolationEqual(i, ('Maria', 'name', 'a'))
|
||||
|
||||
i = Interpolation('Maria', 'name')
|
||||
self.assertInterpolationEqual(i, ('Maria', 'name'))
|
||||
|
||||
i = Interpolation('Maria')
|
||||
self.assertInterpolationEqual(i, ('Maria',))
|
||||
|
||||
def test_creation_interleaving(self):
|
||||
# Should add strings on either side
|
||||
t = Template(Interpolation('Maria', 'name', None, ''))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue