Intialize tests with static timezone instead of using system timezone
authorThierry Florac <tflorac@ulthar.net>
Wed, 12 Jun 2019 13:11:46 +0200
changeset 351 6b5d2db15d6d
parent 350 73abbf667dab
child 352 d9808f01e344
Intialize tests with static timezone instead of using system timezone
src/pyams_utils/doctests/dates.txt
--- a/src/pyams_utils/doctests/dates.txt	Wed Jun 12 13:00:20 2019 +0200
+++ b/src/pyams_utils/doctests/dates.txt	Wed Jun 12 13:11:46 2019 +0200
@@ -4,24 +4,26 @@
 
 Dates functions are used to convert dates from/to string representation:
 
+    >>> import pytz
     >>> from datetime import datetime
     >>> from pyams_utils import date
-    >>> now = datetime.fromtimestamp(1205000000)
+    >>> gmt = pytz.timezone('GMT')
+    >>> now = datetime.fromtimestamp(1205000000, gmt)
     >>> now
-    datetime.datetime(2008, 3, 8, 19, 13, 20)
+    datetime.datetime(2008, 3, 8, 18, 13, 20, tzinfo=<StaticTzInfo 'GMT'>)
 
 You can get an unicode representation of a date in ASCII format using 'unidate' fonction ; date is
 converted to GMT:
 
     >>> udate = date.unidate(now)
     >>> udate
-    '2008-03-08T19:13:20+00:00'
+    '2008-03-08T18:13:20+00:00'
 
 'parse_date' can be used to convert ASCII format into datetime:
 
     >>> ddate = date.parse_date(udate)
     >>> ddate
-    datetime.datetime(2008, 3, 8, 19, 13, 20, tzinfo=<StaticTzInfo 'GMT'>)
+    datetime.datetime(2008, 3, 8, 18, 13, 20, tzinfo=<StaticTzInfo 'GMT'>)
 
 'date_to_datetime' can be used to convert a 'date' type to a 'datetime' value ; if a 'datetime' value
 is used as argument, it is returned 'as is':
@@ -29,7 +31,7 @@
     >>> ddate.date()
     datetime.date(2008, 3, 8)
     >>> date.date_to_datetime(ddate)
-    datetime.datetime(2008, 3, 8, 19, 13, 20, tzinfo=<StaticTzInfo 'GMT'>)
+    datetime.datetime(2008, 3, 8, 18, 13, 20, tzinfo=<StaticTzInfo 'GMT'>)
     >>> date.date_to_datetime(ddate.date())
     datetime.datetime(2008, 3, 8, 0, 0)
 
@@ -49,9 +51,9 @@
 
     >>> from pyams_utils import timezone
     >>> timezone.tztime(ddate)
-    datetime.datetime(2008, 3, 8, 19, 13, 20, tzinfo=<StaticTzInfo 'GMT'>)
+    datetime.datetime(2008, 3, 8, 18, 13, 20, tzinfo=<StaticTzInfo 'GMT'>)
 
 'gmtime' function can be used to convert a datetime to GMT:
 
     >>> timezone.gmtime(now)
-    datetime.datetime(2008, 3, 8, 19, 13, 20, tzinfo=<StaticTzInfo 'GMT'>)
+    datetime.datetime(2008, 3, 8, 18, 13, 20, tzinfo=<StaticTzInfo 'GMT'>)