[Checkins] SVN: zc.async/trunk/src/zc/async/testing. Add bugfix and test to zc.async.testing._datetime.astimezone to make its

Aaron Lehmann aaron at zope.com
Wed Jul 22 14:30:25 EDT 2009


Log message for revision 102075:
  Add bugfix and test to zc.async.testing._datetime.astimezone to make its
  signature match that of datetime.datetimde.astimezone.
  
  

Changed:
  U   zc.async/trunk/src/zc/async/testing.py
  U   zc.async/trunk/src/zc/async/testing.txt

-=-
Modified: zc.async/trunk/src/zc/async/testing.py
===================================================================
--- zc.async/trunk/src/zc/async/testing.py	2009-07-22 18:25:11 UTC (rev 102074)
+++ zc.async/trunk/src/zc/async/testing.py	2009-07-22 18:30:25 UTC (rev 102075)
@@ -45,9 +45,9 @@
     @classmethod
     def utcnow(klass):
         return _now.replace(tzinfo=None)
-    def astimezone(self, tzinfo):
+    def astimezone(self, tz):
         return _datetime(
-            *super(_datetime,self).astimezone(tzinfo).__reduce__()[1])
+            *super(_datetime,self).astimezone(tz).__reduce__()[1])
     def replace(self, *args, **kwargs):
         return _datetime(
             *super(_datetime,self).replace(

Modified: zc.async/trunk/src/zc/async/testing.txt
===================================================================
--- zc.async/trunk/src/zc/async/testing.txt	2009-07-22 18:25:11 UTC (rev 102074)
+++ zc.async/trunk/src/zc/async/testing.txt	2009-07-22 18:30:25 UTC (rev 102075)
@@ -10,8 +10,13 @@
 
     >>> import zc.async.testing
     >>> import datetime
-    >>> dt_now = datetime.datetime.now(tz=None)
+    >>> import pytz
+    >>> dt_now = datetime.datetime.now(tz=pytz.UTC)
     >>> zc.async.testing.set_now(dt_now) #set the frozen now
-    >>> z_a_t_dt_now = zc.async.testing._datetime.now(tz=None)
+    >>> z_a_t_dt_now = zc.async.testing._datetime.now(tz=pytz.UTC)
 
+This tests that the _datetime object provided in the zc.asynt.testing module
+takes correctly named arguments to its astimezone method.
 
+    >>> dt_now = dt_now.astimezone(tz=pytz.UTC)
+    >>> z_a_t_dt_now = z_a_t_dt_now.astimezone(tz=pytz.UTC)



More information about the Checkins mailing list