diff options
author | Michael Foord <michael@python.org> | 2011-03-14 23:03:30 (GMT) |
---|---|---|
committer | Michael Foord <michael@python.org> | 2011-03-14 23:03:30 (GMT) |
commit | ee354eabc996ed532bcd648e628d367468b6c00c (patch) | |
tree | d83a0f2c8a118cfe4d161294f43326c27fa3d3d6 /Lib/test/test_pep292.py | |
parent | 1341bb0019868345bab8adff94263c81e1d66eae (diff) | |
parent | 5596a8c179e3a336bdac46d2982fba20e7e0f4eb (diff) | |
download | cpython-ee354eabc996ed532bcd648e628d367468b6c00c.zip cpython-ee354eabc996ed532bcd648e628d367468b6c00c.tar.gz cpython-ee354eabc996ed532bcd648e628d367468b6c00c.tar.bz2 |
merge default
Diffstat (limited to 'Lib/test/test_pep292.py')
-rw-r--r-- | Lib/test/test_pep292.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_pep292.py b/Lib/test/test_pep292.py index a967649..a1e52e9 100644 --- a/Lib/test/test_pep292.py +++ b/Lib/test/test_pep292.py @@ -42,6 +42,19 @@ class TestTemplate(unittest.TestCase): s = Template('$who likes $$') eq(s.substitute(dict(who='tim', what='ham')), 'tim likes $') + def test_invalid(self): + class MyPattern(Template): + pattern = r""" + (?: + (?P<invalid>) | + (?P<escaped>%(delim)s) | + @(?P<named>%(id)s) | + @{(?P<braced>%(id)s)} + ) + """ + s = MyPattern('$') + self.assertRaises(ValueError, s.substitute, dict()) + def test_percents(self): eq = self.assertEqual s = Template('%(foo)s $foo ${foo}') |