Mercurial Hosting > traffic-intelligence
changeset 107:916678481896
corrected bug for TimeInterval interation and added corresponding test
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 15 Jul 2011 02:32:34 -0400 |
parents | ce4cb46b3603 |
children | 6efe470ea5e5 |
files | python/moving.py python/tests/moving.txt |
diffstat | 2 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/python/moving.py Thu Jul 14 20:05:01 2011 -0400 +++ b/python/moving.py Fri Jul 15 02:32:34 2011 -0400 @@ -10,8 +10,6 @@ __metaclass__ = type -#class MovingObject: - class Interval: '''Generic Interval''' def __init__(self, first=0, last=-1, revert = False): @@ -70,7 +68,7 @@ return self.first+i def __iter__(self): - self.iterInstantNum = 0 + self.iterInstantNum = -1 return self def next(self):
--- a/python/tests/moving.txt Thu Jul 14 20:05:01 2011 -0400 +++ b/python/tests/moving.txt Fri Jul 15 02:32:34 2011 -0400 @@ -19,6 +19,9 @@ >>> TimeInterval(10,8).length() 0.0 +>>> [i for i in TimeInterval(9,13)] +[9, 10, 11, 12, 13] + >>> TimeInterval(2,5).equal(TimeInterval(2,5)) True >>> TimeInterval(2,5).equal(TimeInterval(2,4))