1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
From 085006c9ffc00d3fba3b91eb33111c791a592715 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20R=C3=BCger?= <mrueg@rueg.eu>
Date: Mon, 13 Jul 2015 20:49:51 +0200
Subject: [PATCH] Fix doctests for python3
---
pyrfc3339/generator.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/pyrfc3339/generator.py b/pyrfc3339/generator.py
index 020d47b..62f88e0 100644
--- a/pyrfc3339/generator.py
+++ b/pyrfc3339/generator.py
@@ -9,7 +9,7 @@ def generate(dt, utc=True, accept_naive=False, microseconds=False):
:class:`datetime.datetime`.
>>> from datetime import datetime
- >>> generate(datetime(2009,01,01,12,59,59,0,pytz.utc))
+ >>> generate(datetime(2009,1,1,12,59,59,0,pytz.utc))
'2009-01-01T12:59:59Z'
The timestamp will use UTC unless `utc=False` is specified, in which case
@@ -17,7 +17,7 @@ def generate(dt, utc=True, accept_naive=False, microseconds=False):
:attr:`tzinfo` parameter.
>>> eastern = pytz.timezone('US/Eastern')
- >>> dt = eastern.localize(datetime(2009,01,01,12,59,59))
+ >>> dt = eastern.localize(datetime(2009,1,1,12,59,59))
>>> generate(dt)
'2009-01-01T17:59:59Z'
>>> generate(dt, utc=False)
@@ -25,19 +25,19 @@ def generate(dt, utc=True, accept_naive=False, microseconds=False):
Unless `accept_naive=True` is specified, the `datetime` must not be naive.
- >>> generate(datetime(2009,01,01,12,59,59,0))
+ >>> generate(datetime(2009,1,1,12,59,59,0))
Traceback (most recent call last):
...
ValueError: naive datetime and accept_naive is False
- >>> generate(datetime(2009,01,01,12,59,59,0), accept_naive=True)
+ >>> generate(datetime(2009,1,1,12,59,59,0), accept_naive=True)
'2009-01-01T12:59:59Z'
If `accept_naive=True` is specified, the `datetime` is assumed to be UTC.
Attempting to generate a local timestamp from a naive datetime will result
in an error.
- >>> generate(datetime(2009,01,01,12,59,59,0), accept_naive=True, utc=False)
+ >>> generate(datetime(2009,1,1,12,59,59,0), accept_naive=True, utc=False)
Traceback (most recent call last):
...
ValueError: cannot generate a local timestamp from a naive datetime
|