4
4
import struct
5
5
6
6
import pytest
7
- from six .moves import xrange
7
+ from kafka . vendor . six .moves import range
8
8
9
9
from kafka .codec import (
10
10
has_snappy , has_gzip , has_lz4 ,
18
18
19
19
20
20
def test_gzip ():
21
- for i in xrange (1000 ):
21
+ for i in range (1000 ):
22
22
b1 = random_string (100 ).encode ('utf-8' )
23
23
b2 = gzip_decode (gzip_encode (b1 ))
24
24
assert b1 == b2
25
25
26
26
27
27
@pytest .mark .skipif (not has_snappy (), reason = "Snappy not available" )
28
28
def test_snappy ():
29
- for i in xrange (1000 ):
29
+ for i in range (1000 ):
30
30
b1 = random_string (100 ).encode ('utf-8' )
31
31
b2 = snappy_decode (snappy_encode (b1 ))
32
32
assert b1 == b2
@@ -86,7 +86,7 @@ def test_snappy_encode_xerial():
86
86
@pytest .mark .skipif (not has_lz4 () or platform .python_implementation () == 'PyPy' ,
87
87
reason = "python-lz4 crashes on old versions of pypy" )
88
88
def test_lz4 ():
89
- for i in xrange (1000 ):
89
+ for i in range (1000 ):
90
90
b1 = random_string (100 ).encode ('utf-8' )
91
91
b2 = lz4_decode (lz4_encode (b1 ))
92
92
assert len (b1 ) == len (b2 )
@@ -96,7 +96,7 @@ def test_lz4():
96
96
@pytest .mark .skipif (not has_lz4 () or platform .python_implementation () == 'PyPy' ,
97
97
reason = "python-lz4 crashes on old versions of pypy" )
98
98
def test_lz4_old ():
99
- for i in xrange (1000 ):
99
+ for i in range (1000 ):
100
100
b1 = random_string (100 ).encode ('utf-8' )
101
101
b2 = lz4_decode_old_kafka (lz4_encode_old_kafka (b1 ))
102
102
assert len (b1 ) == len (b2 )
@@ -106,7 +106,7 @@ def test_lz4_old():
106
106
@pytest .mark .skipif (not has_lz4 () or platform .python_implementation () == 'PyPy' ,
107
107
reason = "python-lz4 crashes on old versions of pypy" )
108
108
def test_lz4_incremental ():
109
- for i in xrange (1000 ):
109
+ for i in range (1000 ):
110
110
# lz4 max single block size is 4MB
111
111
# make sure we test with multiple-blocks
112
112
b1 = random_string (100 ).encode ('utf-8' ) * 50000
0 commit comments