summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pep292.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix bug in passing tuples to string.Template. All other values (with workingThomas Wouters2006-07-051-0/+7
| | | | | | | | | | | | | | str() or repr()) would work, just not multi-value tuples. Probably not a backport candidate, since it changes the behaviour of passing a single-element tuple: >>> string.Template("$foo").substitute(dict(foo=(1,))) '(1,)' versus '1'
* SF patch #1056967, changes the semantics of Template.safe_substitute() to notBarry Warsaw2004-11-011-10/+9
| | | | raise a ValueError for dangling delimiters (the delimiter itself is returned).
* Invalid patterns to substitute and safe_substitute would crash since patternNeal Norwitz2004-10-171-0/+12
| | | | is not a local variable. Add a test case.
* Fix small bugs in Template code.Raymond Hettinger2004-09-141-8/+18
| | | | | | | | | | | | | | * The parameterization of "delimiter" was incomplete. * safe_substitute's code for braced delimiters should only be executed when braced is not None. * Invalid pattern group names now raise a ValueError. Formerly, the convert code would fall off the end and improperly return None. Beefed-up tests. * Test delimiter override for all paths in substitute and safe_substitute. * Alter unittest invocation to match other modules (now it itemizes the tests as they are run).
* The 4th group is now 'invalid' instead of 'bogus'.Barry Warsaw2004-09-131-1/+1
|
* Added a test for # positional arguments > 1.Barry Warsaw2004-09-131-0/+4
|
* Add tests for keyword arguments and combining mapping and keyword arguments.Barry Warsaw2004-09-131-0/+28
|
* Many updates to PEP 292 templates. Summary:Barry Warsaw2004-09-101-32/+82
| | | | | | | | | | | | | | | | | - Template no longer inherits from unicode. - SafeTemplate is removed. Now Templates have both a substitute() and a safe_substitute() method, so we don't need separate classes. No more __mod__() operator. - Adopt Tim Peter's idea for giving Template a metaclass, which makes the delimiter, the identifier pattern, or the entire pattern easy to override and document, while retaining efficiency of class-time compilation of the regexp. - More informative ValueError messages which will help a user narrow down the bogus delimiter to the line and column in the original string (helpful for long triple quoted strings).
* PEP 292 classes Template and SafeTemplate are added to the string module.Barry Warsaw2004-08-251-0/+84
This patch includes test cases and documentation updates, as well as NEWS file updates. This patch also updates the sre modules so that they don't import the string module, breaking direct circular imports.