[pypy-svn] r31336 - in pypy/dist/pypy/module/rctime: . test

rhymes at codespeak.net rhymes at codespeak.net
Wed Aug 16 11:52:53 CEST 2006


Author: rhymes
Date: Wed Aug 16 11:52:49 2006
New Revision: 31336

Modified:
   pypy/dist/pypy/module/rctime/app_time.py
   pypy/dist/pypy/module/rctime/test/test_rctime.py
Log:
beautify strptime() and add the test for it, thanks arre

Modified: pypy/dist/pypy/module/rctime/app_time.py
==============================================================================
--- pypy/dist/pypy/module/rctime/app_time.py	(original)
+++ pypy/dist/pypy/module/rctime/app_time.py	Wed Aug 16 11:52:49 2006
@@ -75,9 +75,15 @@
     _float_sleep(secs)
 
     
-def strptime(*args, **kw):
+def strptime(string, format="%a %b %d %H:%M:%S %Y"):
+    """strptime(string, format) -> struct_time
+
+    Parse a string to a time tuple according to a format specification.
+    See the library reference manual for formatting codes
+    (same as strftime())."""
+
     import _strptime
-    return _strptime.strptime(*args, **kw)
+    return _strptime.strptime(string, format)
 
 __doc__ = """This module provides various functions to manipulate time values.
 

Modified: pypy/dist/pypy/module/rctime/test/test_rctime.py
==============================================================================
--- pypy/dist/pypy/module/rctime/test/test_rctime.py	(original)
+++ pypy/dist/pypy/module/rctime/test/test_rctime.py	Wed Aug 16 11:52:49 2006
@@ -247,7 +247,6 @@
         raises(ValueError, rctime.strftime, '', (1900, 1, 1, 0, 0, 0, 0, 1, 2))
 
     def test_strptime(self):
-        skip("strptime is not implemented right now")
         import rctime
         
         t = rctime.time()
@@ -256,7 +255,4 @@
                           'j', 'm', 'M', 'p', 'S',
                           'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'):
             format = ' %' + directive
-            # try:
             rctime.strptime(rctime.strftime(format, tt), format)
-            # except ValueError:
-            #     raise ValueError, "conversion specifier: %r failed.' % format"



More information about the Pypy-commit mailing list