[Python-checkins] python/dist/src/Lib/test test_strptime.py, 1.22, 1.23

bcannon at users.sourceforge.net bcannon at users.sourceforge.net
Thu Aug 28 20:28:56 EDT 2003


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv12267/Lib/test

Modified Files:
	test_strptime.py 
Log Message:
Make sure parentheses are escaped when used in the format string.
Closes bug #796149 .  Will be backported.


Index: test_strptime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** test_strptime.py	11 Aug 2003 19:06:13 -0000	1.22
--- test_strptime.py	29 Aug 2003 02:28:54 -0000	1.23
***************
*** 334,337 ****
--- 334,346 ----
                          " %s != %s" % (strp_output, defaults))
  
+     def test_escaping(self):
+         # Make sure all characters that have regex significance are escaped.
+         # Parentheses are in a purposeful order; will cause an error of
+         # unbalanced parentheses when the regex is compiled if they are not
+         # escaped.
+         # Test instigated by bug #796149 .
+         need_escaping = ".^$*+?{}\[]|)("
+         self.failUnless(_strptime.strptime(need_escaping, need_escaping))
+ 
  class Strptime12AMPMTests(unittest.TestCase):
      """Test a _strptime regression in '%I %p' at 12 noon (12 PM)"""





More information about the Python-checkins mailing list