[Checkins] SVN: zc.async/trunk/src/zc/async/test Fixed an error preventing zc.async.testing._datetime.now from being used with
Aaron Lehmann
aaron at zope.com
Thu Jul 16 15:16:03 EDT 2009
Log message for revision 101948:
Fixed an error preventing zc.async.testing._datetime.now from being used with
keyword arguments in a compatible way with datetime.datetime.now.
Changed:
U zc.async/trunk/src/zc/async/testing.py
A zc.async/trunk/src/zc/async/testing.txt
U zc.async/trunk/src/zc/async/tests.py
-=-
Modified: zc.async/trunk/src/zc/async/testing.py
===================================================================
--- zc.async/trunk/src/zc/async/testing.py 2009-07-16 18:41:15 UTC (rev 101947)
+++ zc.async/trunk/src/zc/async/testing.py 2009-07-16 19:16:03 UTC (rev 101948)
@@ -37,11 +37,11 @@
class _datetime(old_datetime):
@classmethod
- def now(klass, tzinfo=None):
- if tzinfo is None:
+ def now(klass, tz=None):
+ if tz is None:
return _now.replace(tzinfo=None)
else:
- return _now.astimezone(tzinfo)
+ return _now.astimezone(tz)
@classmethod
def utcnow(klass):
return _now.replace(tzinfo=None)
Added: zc.async/trunk/src/zc/async/testing.txt
===================================================================
--- zc.async/trunk/src/zc/async/testing.txt (rev 0)
+++ zc.async/trunk/src/zc/async/testing.txt 2009-07-16 19:16:03 UTC (rev 101948)
@@ -0,0 +1,10 @@
+Testing Edge Case
+=================
+
+This tests that the _datetime class provided in the zc.asynt.testing module
+takes correctly named arguments to its now method.
+
+ >>> import zc.async.testing
+ >>> import datetime
+ >>> dt_now = datetime.datetime.now(tz=None)
+ >>> z_a_t_dt_now = zc.async.testing._datetime.now(tz=None)
Modified: zc.async/trunk/src/zc/async/tests.py
===================================================================
--- zc.async/trunk/src/zc/async/tests.py 2009-07-16 18:41:15 UTC (rev 101947)
+++ zc.async/trunk/src/zc/async/tests.py 2009-07-16 19:16:03 UTC (rev 101948)
@@ -150,6 +150,7 @@
'catastrophes.txt',
'catastrophes_revisited.txt',
'ftesting.txt',
+ 'testing.txt',
'QUICKSTART_1_VIRTUALENV.txt',
setUp=modSetUp, tearDown=modTearDown,
optionflags=doctest.INTERPRET_FOOTNOTES,
More information about the Checkins
mailing list