Blob Blame History Raw
*** test/test_codec.py.orig	Mon Jul 10 23:03:00 2023
--- test/test_codec.py	Mon Jul 10 23:03:41 2023
***************
*** 4,10 ****
  import struct
  
  import pytest
! from kafka.vendor.six.moves import range
  
  from kafka.codec import (
      has_snappy, has_lz4, has_zstd,
--- 4,10 ----
  import struct
  
  import pytest
! from kafka.vendor.six import moves
  
  from kafka.codec import (
      has_snappy, has_lz4, has_zstd,
***************
*** 19,25 ****
  
  
  def test_gzip():
!     for i in range(1000):
          b1 = random_string(100).encode('utf-8')
          b2 = gzip_decode(gzip_encode(b1))
          assert b1 == b2
--- 19,25 ----
  
  
  def test_gzip():
!     for i in moves.range(1000):
          b1 = random_string(100).encode('utf-8')
          b2 = gzip_decode(gzip_encode(b1))
          assert b1 == b2
***************
*** 27,33 ****
  
  @pytest.mark.skipif(not has_snappy(), reason="Snappy not available")
  def test_snappy():
!     for i in range(1000):
          b1 = random_string(100).encode('utf-8')
          b2 = snappy_decode(snappy_encode(b1))
          assert b1 == b2
--- 27,33 ----
  
  @pytest.mark.skipif(not has_snappy(), reason="Snappy not available")
  def test_snappy():
!     for i in moves.range(1000):
          b1 = random_string(100).encode('utf-8')
          b2 = snappy_decode(snappy_encode(b1))
          assert b1 == b2
***************
*** 87,93 ****
  @pytest.mark.skipif(not has_lz4() or platform.python_implementation() == 'PyPy',
                      reason="python-lz4 crashes on old versions of pypy")
  def test_lz4():
!     for i in range(1000):
          b1 = random_string(100).encode('utf-8')
          b2 = lz4_decode(lz4_encode(b1))
          assert len(b1) == len(b2)
--- 87,93 ----
  @pytest.mark.skipif(not has_lz4() or platform.python_implementation() == 'PyPy',
                      reason="python-lz4 crashes on old versions of pypy")
  def test_lz4():
!     for i in moves.range(1000):
          b1 = random_string(100).encode('utf-8')
          b2 = lz4_decode(lz4_encode(b1))
          assert len(b1) == len(b2)
***************
*** 97,103 ****
  @pytest.mark.skipif(not has_lz4() or platform.python_implementation() == 'PyPy',
                      reason="python-lz4 crashes on old versions of pypy")
  def test_lz4_old():
!     for i in range(1000):
          b1 = random_string(100).encode('utf-8')
          b2 = lz4_decode_old_kafka(lz4_encode_old_kafka(b1))
          assert len(b1) == len(b2)
--- 97,103 ----
  @pytest.mark.skipif(not has_lz4() or platform.python_implementation() == 'PyPy',
                      reason="python-lz4 crashes on old versions of pypy")
  def test_lz4_old():
!     for i in moves.range(1000):
          b1 = random_string(100).encode('utf-8')
          b2 = lz4_decode_old_kafka(lz4_encode_old_kafka(b1))
          assert len(b1) == len(b2)
***************
*** 107,113 ****
  @pytest.mark.skipif(not has_lz4() or platform.python_implementation() == 'PyPy',
                      reason="python-lz4 crashes on old versions of pypy")
  def test_lz4_incremental():
!     for i in range(1000):
          # lz4 max single block size is 4MB
          # make sure we test with multiple-blocks
          b1 = random_string(100).encode('utf-8') * 50000
--- 107,113 ----
  @pytest.mark.skipif(not has_lz4() or platform.python_implementation() == 'PyPy',
                      reason="python-lz4 crashes on old versions of pypy")
  def test_lz4_incremental():
!     for i in moves.range(1000):
          # lz4 max single block size is 4MB
          # make sure we test with multiple-blocks
          b1 = random_string(100).encode('utf-8') * 50000
***************
*** 118,124 ****
  
  @pytest.mark.skipif(not has_zstd(), reason="Zstd not available")
  def test_zstd():
!     for _ in range(1000):
          b1 = random_string(100).encode('utf-8')
          b2 = zstd_decode(zstd_encode(b1))
          assert b1 == b2
--- 118,124 ----
  
  @pytest.mark.skipif(not has_zstd(), reason="Zstd not available")
  def test_zstd():
!     for _ in moves.range(1000):
          b1 = random_string(100).encode('utf-8')
          b2 = zstd_decode(zstd_encode(b1))
          assert b1 == b2