~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Lib/test/test_pep292.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-11 13:30:19 UTC
  • mto: (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20100311133019-sblbooa3uqrkoe70
Tags: upstream-2.6.5~rc2
ImportĀ upstreamĀ versionĀ 2.6.5~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
        s = Template('$who likes $100')
87
87
        raises(ValueError, s.substitute, dict(who='tim'))
88
88
 
89
 
    def test_delimiter_override(self):
90
 
        class PieDelims(Template):
91
 
            delimiter = '@'
92
 
        s = PieDelims('@who likes to eat a bag of @{what} worth $100')
93
 
        self.assertEqual(s.substitute(dict(who='tim', what='ham')),
94
 
                         'tim likes to eat a bag of ham worth $100')
95
 
 
96
89
    def test_idpattern_override(self):
97
90
        class PathPattern(Template):
98
91
            idpattern = r'[_a-z][._a-z0-9]*'
183
176
        raises(ValueError, s.substitute, dict(gift='bud', who='you'))
184
177
        eq(s.safe_substitute(), 'this &gift is for &{who} &')
185
178
 
 
179
        class PieDelims(Template):
 
180
            delimiter = '@'
 
181
        s = PieDelims('@who likes to eat a bag of @{what} worth $100')
 
182
        self.assertEqual(s.substitute(dict(who='tim', what='ham')),
 
183
                         'tim likes to eat a bag of ham worth $100')
 
184
 
186
185
 
187
186
def test_main():
188
187
    from test import test_support