mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Added a test for # positional arguments > 1.
This commit is contained in:
parent
7642f7af0d
commit
c7cd20c8c6
1 changed files with 4 additions and 0 deletions
|
@ -134,6 +134,7 @@ class TestTemplate(unittest.TestCase):
|
|||
|
||||
def test_keyword_arguments_safe(self):
|
||||
eq = self.assertEqual
|
||||
raises = self.assertRaises
|
||||
s = Template('$who likes $what')
|
||||
eq(s.safe_substitute(who='tim', what='ham'), 'tim likes ham')
|
||||
eq(s.safe_substitute(dict(who='tim'), what='ham'), 'tim likes ham')
|
||||
|
@ -145,6 +146,9 @@ class TestTemplate(unittest.TestCase):
|
|||
'the mapping is bozo')
|
||||
eq(s.safe_substitute(dict(mapping='one'), mapping='two'),
|
||||
'the mapping is two')
|
||||
d = dict(mapping='one')
|
||||
raises(TypeError, s.substitute, d, {})
|
||||
raises(TypeError, s.safe_substitute, d, {})
|
||||
|
||||
|
||||
def suite():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue