author | Alberto Bertogli
<albertito@blitiri.com.ar> 2010-04-14 21:07:16 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2010-04-14 21:10:42 UTC |
parent | d7d5711ad5ba7c0b72083174452d0044b6e99182 |
tests/python/random1-cache.py | +1 | -1 |
tests/python3/random1-cache.py | +1 | -1 |
diff --git a/tests/python/random1-cache.py b/tests/python/random1-cache.py index 33ca332..0e95dc5 100755 --- a/tests/python/random1-cache.py +++ b/tests/python/random1-cache.py @@ -105,7 +105,7 @@ if __name__ == '__main__': # operate on them a bit print 'random operations' operations = ('set', 'get', 'delete') - for i in xrange(nkeys / 2): + for i in xrange(min(len(lkeys), nkeys / 2)): op = choice(operations) k = choice(lkeys) if op == 'set': diff --git a/tests/python3/random1-cache.py b/tests/python3/random1-cache.py index 71e8b9f..f5e4ac2 100755 --- a/tests/python3/random1-cache.py +++ b/tests/python3/random1-cache.py @@ -105,7 +105,7 @@ if __name__ == '__main__': # operate on them a bit print('random operations') operations = ('set', 'get', 'delete') - for i in range(nkeys // 2): + for i in range(min(len(lkeys), nkeys // 2)): op = choice(operations) k = choice(lkeys) if op == 'set':