simply test suite

This commit is contained in:
2017-05-27 12:07:57 -04:00
parent 6c1cc24ad5
commit d50dc8701c
2 changed files with 11 additions and 8 deletions
+2 -2
View File
@@ -62,7 +62,7 @@ class MayaDT(object):
@validate_class_type_arguments('==')
def __eq__(self, maya_dt):
return self._epoch == maya_dt._epoch
return int(self._epoch) == int(maya_dt._epoch)
@validate_class_type_arguments('!=')
def __ne__(self, maya_dt):
@@ -85,7 +85,7 @@ class MayaDT(object):
return self._epoch >= maya_dt._epoch
def __hash__(self):
return hash(self.epoch)
return hash(int(self.epoch))
def __add__(self, item):
return self.add(seconds=seconds_or_timedelta(item).total_seconds())
+9 -6
View File
@@ -34,9 +34,9 @@ def test_interval_requires_2_of_start_end_duration():
def test_interval_requires_end_time_after_or_on_start_time():
maya.MayaInterval(start=maya.now(), duration=0)
with pytest.raises(ValueError):
maya.MayaInterval(start=maya.now(), duration=0)
maya.MayaInterval(start=maya.now(), duration=-1)
@@ -464,11 +464,14 @@ def test_interval_flatten_non_overlapping():
def test_interval_flatten_adjacent():
step = 2
max_hour = 20
base = maya.now()
intervals = [maya.MayaInterval(
start=base.add(hours=hour),
duration=timedelta(hours=step),
) for hour in range(0, max_hour, step)]
base = maya.when('jan/1/2011')
intervals = [
maya.MayaInterval(
start=base.add(hours=hour),
duration=timedelta(hours=step),
) for hour in range(0, max_hour, step)
]
random.shuffle(intervals)
assert maya.MayaInterval.flatten(intervals) == [maya.MayaInterval(