mirror of
https://github.com/kennethreitz/maya.git
synced 2026-06-05 06:46:14 +00:00
simply test suite
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user