tests didn't pass fxrange

This commit is contained in:
Ask Solem 2011-01-07 11:22:05 +01:00
parent 387e979840
commit eed34140ae
2 changed files with 12 additions and 11 deletions

View File

@ -182,7 +182,7 @@ def insomnia(fun):
return _inner
class test_retry_over_Time(unittest.TestCase):
class test_retry_over_time(unittest.TestCase):
@insomnia
def test_simple(self):
@ -193,15 +193,15 @@ class test_retry_over_Time(unittest.TestCase):
def myfun():
sleepvals = {0: None,
1: 2,
2: 4,
3: 6,
4: 8,
5: 10,
6: 12,
7: 14,
8: 14,
9: 14}
1: 2.0,
2: 4.0,
3: 6.0,
4: 8.0,
5: 10.0,
6: 12.0,
7: 14.0,
8: 16.0,
9: 16.0}
self.assertEqual(_tried_to_sleep[0], sleepvals[index[0]])
if index[0] < 9:
raise Predicate()

View File

@ -62,7 +62,8 @@ def fxrange(start=1.0, stop=None, step=1.0, repeatlast=False):
while 1:
if cur <= stop:
yield cur
cur += step
if cur + step <= stop:
cur += step
else:
if not repeatlast:
break