@@ -18,9 +18,9 @@ def test_simple(self):
18
18
it = retrying .simpleBackoffIterator ()
19
19
20
20
# by default "now" is set
21
- self .assertEquals (it . next (), 0 )
21
+ self .assertEquals (next (it ), 0 )
22
22
23
- r1 , r2 , r3 = it . next (), it . next (), it . next ()
23
+ r1 , r2 , r3 = next (it ), next (it ), next (it )
24
24
self .assertTrue (r1 < r2 < r3 )
25
25
26
26
def test_maxDelay (self ):
@@ -29,32 +29,32 @@ def test_maxDelay(self):
29
29
"""
30
30
it = retrying .simpleBackoffIterator (maxDelay = 2.0 )
31
31
32
- res = [it . next () for _ in range (5 )]
32
+ res = [next (it ) for _ in range (5 )]
33
33
self .assertEquals (res [- 1 ], 2.0 )
34
34
35
35
def test_notNow (self ):
36
36
"""
37
37
If now is not set, the first delay is not zero.
38
38
"""
39
39
it = retrying .simpleBackoffIterator (now = False )
40
- self .assertNotEquals (it . next (), 0 )
40
+ self .assertNotEquals (next (it ), 0 )
41
41
42
42
def test_maxRetries (self ):
43
43
"""
44
44
The iterator gets exhausted if retries are capped.
45
45
"""
46
46
it = retrying .simpleBackoffIterator (maxRetries = 3 )
47
47
48
- it . next (), it . next (), it . next ()
49
- self .assertRaises (StopIteration , it . next )
48
+ next (it ), next (it ), next (it )
49
+ self .assertRaises (StopIteration , lambda : next ( it ) )
50
50
51
51
def test_noMaxRetries (self ):
52
52
"""
53
53
The iterator does not get exhausted if retries are not capped.
54
54
"""
55
55
it = retrying .simpleBackoffIterator (maxRetries = 0 , maxDelay = 1 )
56
56
57
- alot = [it . next () for _ in range (1000 )]
57
+ alot = [next (it ) for _ in range (1000 )]
58
58
self .assertEquals (alot [- 1 ], 1 )
59
59
60
60
def test_noMaxDelay (self ):
@@ -64,7 +64,7 @@ def test_noMaxDelay(self):
64
64
it = retrying .simpleBackoffIterator (maxRetries = 0 , maxDelay = 0 )
65
65
66
66
# putting range(1000) here makes Python return a NaN, so be moderate
67
- alot = [it . next () for _ in range (100 )]
67
+ alot = [next (it ) for _ in range (100 )]
68
68
self .assertTrue (alot [- 2 ] < alot [- 1 ])
69
69
70
70
def test_precise (self ):
@@ -75,12 +75,12 @@ def test_precise(self):
75
75
it = retrying .simpleBackoffIterator (initialDelay = 10 , maxDelay = 90 ,
76
76
factor = 2 , jitter = 0 )
77
77
78
- self .assertEquals (it . next (), 0 )
79
- self .assertEquals (it . next (), 20 )
80
- self .assertEquals (it . next (), 40 )
81
- self .assertEquals (it . next (), 80 )
82
- self .assertEquals (it . next (), 90 )
83
- self .assertEquals (it . next (), 90 )
78
+ self .assertEquals (
B4E9
next (it ), 0 )
79
+ self .assertEquals (next (it ), 20 )
80
+ self .assertEquals (next (it ), 40 )
81
+ self .assertEquals (next (it ), 80 )
82
+ self .assertEquals (next (it ), 90 )
83
+ self .assertEquals (next (it ), 90 )
84
84
85
85
86
86
class TestRetryingCall (unittest .TestCase ):
0 commit comments