Fix subtracting MayaDT instances. Fixes #151

This commit is contained in:
Timo Furrer
2018-05-10 11:04:16 +02:00
parent 046f005ca7
commit 8468dd2ead
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -152,7 +152,7 @@ class MayaDT(object):
def subtract_date(self, **kwargs):
"""Returns a timedelta object with the duration between the dates"""
return timedelta(self.epoch - kwargs['dt'].epoch)
return timedelta(seconds=self.epoch - kwargs['dt'].epoch)
def snap(self, instruction):
"""
+2 -2
View File
@@ -320,8 +320,8 @@ def test_dunder_sub():
def test_mayaDT_sub():
now = maya.now()
then = now.add(days=1)
assert then - now == timedelta(24 * 60 * 60)
assert now - then == timedelta(-24 * 60 * 60)
assert then - now == timedelta(seconds=24 * 60 * 60)
assert now - then == timedelta(seconds=-24 * 60 * 60)
def test_core_local_timezone(monkeypatch):