Compare commits

...

5 Commits

Author SHA1 Message Date
Timo Furrer 1b432d6626 release: 0.4.3 2018-05-15 09:13:21 +02:00
Timo Furrer f09d6eec63 Split RFC3339 test 2018-05-15 09:13:01 +02:00
Timo Furrer 62a6283200 Merge pull request #150 from marcelstoer/patch-1
Fix RFC3339 representation
2018-05-15 09:08:52 +02:00
Marcel Stör 9ef43a29d9 Add RFC3339 unit test 2018-05-14 21:49:47 +02:00
Marcel Stör a2bff42439 Fix RFC3339 representation
Must be at most 1-digit millisecond.
2018-05-14 20:48:28 +02:00
3 changed files with 10 additions and 3 deletions
+1 -1
View File
@@ -1 +1 @@
__version__ = '0.4.2'
__version__ = '0.4.3'
+1 -1
View File
@@ -277,7 +277,7 @@ class MayaDT(object):
def rfc3339(self):
"""Returns an RFC 3339 representation of the MayaDT."""
return self.datetime().strftime("%Y-%m-%dT%H:%M:%S.%f")[:-4] + "Z"
return self.datetime().strftime("%Y-%m-%dT%H:%M:%S.%f")[:-5] + "Z"
# Properties
# ----------
+8 -1
View File
@@ -239,13 +239,20 @@ def test_datetime_to_timezone():
assert dt.tzinfo.zone == 'US/Eastern'
def test_rfc3339():
def test_rfc3339_epoch():
mdt = maya.when('2016-01-01')
out = mdt.rfc3339()
mdt2 = maya.MayaDT.from_rfc3339(out)
assert mdt.epoch == mdt2.epoch
def test_rfc3339_format():
rfc3339 = maya.MayaDT.rfc3339(maya.when('2016-01-01T12:03:03Z'))
# it's important that the string has got a "max 1-digit millis" fragment
# as per https://tools.ietf.org/html/rfc3339#section-5.6
assert rfc3339 == '2016-01-01T12:03:03.0Z'
@pytest.mark.usefixtures("frozen_now")
def test_comparison_operations():
now = maya.now()