mirror of
https://github.com/kennethreitz/maya.git
synced 2026-06-05 23:00:18 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1b432d6626 | |||
| f09d6eec63 | |||
| 62a6283200 | |||
| 9ef43a29d9 | |||
| a2bff42439 |
+1
-1
@@ -1 +1 @@
|
|||||||
__version__ = '0.4.2'
|
__version__ = '0.4.3'
|
||||||
|
|||||||
+1
-1
@@ -277,7 +277,7 @@ class MayaDT(object):
|
|||||||
|
|
||||||
def rfc3339(self):
|
def rfc3339(self):
|
||||||
"""Returns an RFC 3339 representation of the MayaDT."""
|
"""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
|
# Properties
|
||||||
# ----------
|
# ----------
|
||||||
|
|||||||
+8
-1
@@ -239,13 +239,20 @@ def test_datetime_to_timezone():
|
|||||||
assert dt.tzinfo.zone == 'US/Eastern'
|
assert dt.tzinfo.zone == 'US/Eastern'
|
||||||
|
|
||||||
|
|
||||||
def test_rfc3339():
|
def test_rfc3339_epoch():
|
||||||
mdt = maya.when('2016-01-01')
|
mdt = maya.when('2016-01-01')
|
||||||
out = mdt.rfc3339()
|
out = mdt.rfc3339()
|
||||||
mdt2 = maya.MayaDT.from_rfc3339(out)
|
mdt2 = maya.MayaDT.from_rfc3339(out)
|
||||||
assert mdt.epoch == mdt2.epoch
|
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")
|
@pytest.mark.usefixtures("frozen_now")
|
||||||
def test_comparison_operations():
|
def test_comparison_operations():
|
||||||
now = maya.now()
|
now = maya.now()
|
||||||
|
|||||||
Reference in New Issue
Block a user