[Python-checkins] python/nondist/sandbox/string/tests test_pep292.py, 1.2, 1.3

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Thu Aug 12 23:22:54 CEST 2004


Update of /cvsroot/python/python/nondist/sandbox/string/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7979
Modified Files:
	test_pep292.py 
Log Message:
Capitalized the class names.
Removed the yucky page breaks.
Index: test_pep292.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/string/tests/test_pep292.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_pep292.py	10 Aug 2004 22:27:46 -0000	1.2
--- test_pep292.py	12 Aug 2004 21:22:51 -0000	1.3
***************
*** 4,14 ****
 
 import unittest
! from string import template, safe_template
 
 
- 
- class TestTemplates(unittest.TestCase):
 def test_regular_templates(self):
! s = template('$who likes to eat a bag of $what worth 100ドル')
 self.assertEqual(s % dict(who='tim', what='ham'),
 'tim likes to eat a bag of ham worth 100ドル')
--- 4,13 ----
 
 import unittest
! from string import Template, SafeTemplate
 
+ class TestTemplate(unittest.TestCase):
 
 def test_regular_templates(self):
! s = Template('$who likes to eat a bag of $what worth 100ドル')
 self.assertEqual(s % dict(who='tim', what='ham'),
 'tim likes to eat a bag of ham worth 100ドル')
***************
*** 16,20 ****
 
 def test_regular_templates_with_braces(self):
! s = template('$who likes ${what} for ${meal}')
 self.assertEqual(s % dict(who='tim', what='ham', meal='dinner'),
 'tim likes ham for dinner')
--- 15,19 ----
 
 def test_regular_templates_with_braces(self):
! s = Template('$who likes ${what} for ${meal}')
 self.assertEqual(s % dict(who='tim', what='ham', meal='dinner'),
 'tim likes ham for dinner')
***************
*** 24,40 ****
 def test_escapes(self):
 eq = self.assertEqual
! s = template('$who likes to eat a bag of $$what worth 100ドル')
 eq(s % dict(who='tim', what='ham'),
 'tim likes to eat a bag of $what worth 100ドル')
 
 def test_percents(self):
! s = template('%(foo)s $foo ${foo}')
 self.assertEqual(s % dict(foo='baz'), '%(foo)s baz baz')
! s = safe_template('%(foo)s $foo ${foo}')
 self.assertEqual(s % dict(foo='baz'), '%(foo)s baz baz')
 
! def test_safe_templates(self):
 eq = self.assertEqual
! s = safe_template('$who likes ${what} for ${meal}')
 eq(s % dict(who='tim'),
 'tim likes ${what} for ${meal}')
--- 23,39 ----
 def test_escapes(self):
 eq = self.assertEqual
! s = Template('$who likes to eat a bag of $$what worth 100ドル')
 eq(s % dict(who='tim', what='ham'),
 'tim likes to eat a bag of $what worth 100ドル')
 
 def test_percents(self):
! s = Template('%(foo)s $foo ${foo}')
 self.assertEqual(s % dict(foo='baz'), '%(foo)s baz baz')
! s = SafeTemplate('%(foo)s $foo ${foo}')
 self.assertEqual(s % dict(foo='baz'), '%(foo)s baz baz')
 
! def test_SafeTemplate(self):
 eq = self.assertEqual
! s = SafeTemplate('$who likes ${what} for ${meal}')
 eq(s % dict(who='tim'),
 'tim likes ${what} for ${meal}')
***************
*** 49,53 ****
 
 
- 
 def test_suite():
 suite = unittest.TestSuite()
--- 48,51 ----


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /