py3: Replace xrange() with range()
This commit is contained in:
parent
cd3d44ff6d
commit
f58fe9a192
@ -76,7 +76,7 @@ def parse_pls(data):
|
||||
for section in cp.sections():
|
||||
if section.lower() != 'playlist':
|
||||
continue
|
||||
for i in xrange(cp.getint(section, 'numberofentries')):
|
||||
for i in range(cp.getint(section, 'numberofentries')):
|
||||
yield cp.get(section, 'file%d' % (i+1))
|
||||
|
||||
|
||||
|
||||
@ -25,10 +25,10 @@ def _levenshtein(a, b):
|
||||
if n > m:
|
||||
return _levenshtein(b, a)
|
||||
|
||||
current = xrange(n + 1)
|
||||
for i in xrange(1, m + 1):
|
||||
current = range(n + 1)
|
||||
for i in range(1, m + 1):
|
||||
previous, current = current, [i] + [0] * n
|
||||
for j in xrange(1, n + 1):
|
||||
for j in range(1, n + 1):
|
||||
add, delete = previous[j] + 1, current[j - 1] + 1
|
||||
change = previous[j - 1]
|
||||
if a[j - 1] != b[i - 1]:
|
||||
|
||||
@ -98,7 +98,8 @@ class StatusHandlerTest(unittest.TestCase):
|
||||
def test_status_method_contains_playlist(self):
|
||||
result = dict(status.status(self.context))
|
||||
self.assertIn('playlist', result)
|
||||
self.assertIn(int(result['playlist']), xrange(0, 2 ** 31 - 1))
|
||||
self.assertGreaterEqual(int(result['playlist']), 0)
|
||||
self.assertLessEqual(int(result['playlist']), 2 ** 31 - 1)
|
||||
|
||||
def test_status_method_contains_playlistlength(self):
|
||||
result = dict(status.status(self.context))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user