Mercurial > hg
diff tests/test-pathencode.py @ 49285:56f98406831b
py3: remove xrange() compatibility code
Some code used its own xrange() compatibility code instead of
pycompat.xrange().
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Sun, 29 May 2022 15:32:43 +0200 |
parents | 2cce2fa5bcf7 |
children |
line wrap: on
line diff
--- a/tests/test-pathencode.py Sun May 29 15:17:27 2022 +0200 +++ b/tests/test-pathencode.py Sun May 29 15:32:43 2022 +0200 @@ -19,11 +19,6 @@ store, ) -try: - xrange -except NameError: - xrange = range - validchars = set(map(pycompat.bytechr, range(0, 256))) alphanum = range(ord('A'), ord('Z')) @@ -32,8 +27,8 @@ winreserved = ( b'aux con prn nul'.split() - + [b'com%d' % i for i in xrange(1, 10)] - + [b'lpt%d' % i for i in xrange(1, 10)] + + [b'com%d' % i for i in range(1, 10)] + + [b'lpt%d' % i for i in range(1, 10)] ) @@ -43,8 +38,8 @@ combos = set() for r in names: - for i in xrange(len(r) + 1): - for c in itertools.combinations(xrange(len(r)), i): + for i in range(len(r) + 1): + for c in itertools.combinations(range(len(r)), i): d = r for j in c: d = b''.join((d[:j], d[j : j + 1].upper(), d[j + 1 :])) @@ -211,7 +206,7 @@ return ( b'data/' - + b'/'.join(makepart(rng, k) for _ in xrange(j)) + + b'/'.join(makepart(rng, k) for _ in range(j)) + rng.choice([b'.d', b'.i']) ) @@ -222,7 +217,7 @@ mink, maxk = 1, 4096 def steps(): - for i in xrange(count): + for i in range(count): yield mink + int(round(math.sqrt((maxk - mink) * float(i) / count))) for k in steps():