Georges Racinet committed 5a6a3f7

#1: accepted optional time zone arg in now()

Comments (0)

Files changed (4)

+Version 0.3.1 (2012-11-28)
+ - #1: tested code using time zone optional arg of now() doesn't break
+   any more (no real time zone support, though)
 Version 0.3 (2012-11-23)
 computational methods, actually return an object of the original
 ``datetime`` class. This works with python >= 2.6 only.
-First let's check that our class is a subclass of the orininal
+First let's check that our class is a subclass of the original
 one. If this fails, this test does not mean anything anymore::
   >>> datetime.datetime is datetime.original_datetime
   >>> issubclass(datetime.original_datetime, datetime.datetime)
+We'll need a ``tzinfo`` subclass from now on.
+  >>> from datetime import tzinfo
+  >>> class mytzinfo(tzinfo):
+  ...     def utcoffset(self, dt):
+  ...         return timedelta(hours=2)
+  ...     def dst(self, dt):
+  ...         return timedelta(0)
+When ``anybox.testing.datetime`` is not in use, the optional time zone
+argument of ``now`` can be passed without error
+  >>> n =


     _current_now = None
-    def now(cls):
+    def now(cls, *a):
         now = cls._current_now
         if now is not None:
+            # TODO timezone treatment
             return cls._current_now
-        return
+        return*a)
     def set_now(cls, value):
 from setuptools import setup, find_packages
-version = '0.3'
+version = '0.3.1'
     name = "anybox.testing.datetime",
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.