cpython: 8a98ee6baa1e (original) (raw)

Mercurial > cpython

changeset 92856:8a98ee6baa1e 2.7

Issue #1686: Fix string.Template when overriding the pattern attribute. [#1686]

Florent Xicluna florent.xicluna@gmail.com
date Sat, 18 Sep 2010 23:34:07 +0000
parents 6e2a72e05b4f
children b6fab5c89ca9
files Lib/string.py Lib/test/test_pep292.py Misc/NEWS
diffstat 3 files changed, 39 insertions(+), 9 deletions(-)[+] [-] Lib/string.py 12 Lib/test/test_pep292.py 34 Misc/NEWS 2

line wrap: on

line diff

--- a/Lib/string.py +++ b/Lib/string.py @@ -182,24 +182,18 @@ class Template: mapping = args[0] # Helper function for .sub() def convert(mo):

--- a/Lib/test/test_pep292.py +++ b/Lib/test/test_pep292.py @@ -125,6 +125,40 @@ class TestTemplate(unittest.TestCase): self.assertRaises(ValueError, s.substitute, {}) self.assertRaises(ValueError, s.safe_substitute, {})

+

+

+

+ def test_unicode_values(self): s = Template('$who likes $what') d = dict(who=u't\xffm', what=u'f\xfe\fed')

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -34,6 +34,8 @@ Core and Builtins Library ------- +- Issue #1686: Fix string.Template when overriding the pattern attribute. +