pytz/tests/test_docs.py also fails on Python 3.8 because repr(datetime.timedelta) changed to include parameter names. Example of failure:
File "pytz/tests/../../README.txt", line 213, in README.txt
Failed example:
tz.dst(normal)
Expected:
datetime.timedelta(0, 3600)
Got:
datetime.timedelta(seconds=3600)
I propose the following fix which should work on all Python versions:
--- README.txt.old 2019-03-14 15:11:54.360631826 +0100
+++ README.txt 2019-03-14 15:13:31.809592925 +0100
@@ -177,29 +177,29 @@
The ``is_dst`` parameter is ignored for most timestamps. It is only used
during DST transition ambiguous periods to resolve that ambiguity.
pytz/tests/ test_docs. py also fails on Python 3.8 because repr(datetime. timedelta) changed to include parameter names. Example of failure:
File "pytz/tests/ ../../README. txt", line 213, in README.txt timedelta( 0, 3600) timedelta( seconds= 3600)
Failed example:
tz.dst(normal)
Expected:
datetime.
Got:
datetime.
I propose the following fix which should work on all Python versions:
--- README.txt.old 2019-03-14 15:11:54.360631826 +0100
+++ README.txt 2019-03-14 15:13:31.809592925 +0100
@@ -177,29 +177,29 @@
The ``is_dst`` parameter is ignored for most timestamps. It is only used
during DST transition ambiguous periods to resolve that ambiguity.
->>> tz.utcoffset( normal, is_dst=True) timedelta( -1, 77400) timedelta( 0, 3600) utcoffset( normal, is_dst=True)) dst(normal, is_dst=True))
-datetime.
->>> tz.dst(normal, is_dst=True)
-datetime.
+>>> print(tz.
+-1 day, 21:30:00
+>>> print(tz.
+1:00:00
>>> tz.tzname(normal, is_dst=True)
'NDT'
->>> tz.utcoffset( ambiguous, is_dst=True) timedelta( -1, 77400) timedelta( 0, 3600) utcoffset( ambiguous, is_dst=True)) dst(ambiguous, is_dst=True)) ambiguous, is_dst=True)
-datetime.
->>> tz.dst(ambiguous, is_dst=True)
-datetime.
+>>> print(tz.
+-1 day, 21:30:00
+>>> print(tz.
+1:00:00
>>> tz.tzname(
'NDT'
->>> tz.utcoffset( normal, is_dst=False) timedelta( -1, 77400) timedelta( 0, 3600) utcoffset( normal, is_dst=False)) dst(normal, is_dst=False))
-datetime.
->>> tz.dst(normal, is_dst=False)
-datetime.
+>>> print(tz.
+-1 day, 21:30:00
+>>> print(tz.
+1:00:00
>>> tz.tzname(normal, is_dst=False)
'NDT'
->>> tz.utcoffset( ambiguous, is_dst=False) timedelta( -1, 73800) utcoffset( ambiguous, is_dst=False)) timedelta( 0) ambiguous, is_dst=False) exceptions. AmbiguousTimeEr ror`` exception.
-datetime.
+>>> print(tz.
+-1 day, 20:30:00
>>> tz.dst(ambiguous, is_dst=False)
datetime.
>>> tz.tzname(
@@ -208,10 +208,10 @@
If ``is_dst`` is not specified, ambiguous timestamps will raise
an ``pytz.
->>> tz.utcoffset( normal) timedelta( -1, 77400) timedelta( 0, 3600) utcoffset( normal) ) dst(normal) )
-datetime.
->>> tz.dst(normal)
-datetime.
+>>> print(tz.
+-1 day, 21:30:00
+>>> print(tz.
+1:00:00
>>> tz.tzname(normal)
'NDT'