Skip to content

Commit 53685f9

Browse files
committed
fix(test): change tests to run on python 3.14
Signed-off-by: Lídia Tarcza <[email protected]>
1 parent 25c357e commit 53685f9

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

test/test_base_service.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,6 @@ def test_gzip_compression():
677677
def test_gzip_compression_file_input():
678678
service = AnyServiceV1('2018-11-20', authenticator=NoAuthAuthenticator())
679679
service.set_enable_gzip_compression(True)
680-
681680
# Should return file-like object with the compressed data when compression is on
682681
# and the input is a file, opened for reading in binary mode.
683682
raw_data = b'rawdata'
@@ -686,21 +685,23 @@ def test_gzip_compression_file_input():
686685
tmp_file.seek(0)
687686

688687
prepped = service.prepare_request('GET', url='', data=tmp_file)
689-
assert gzip.decompress(prepped['data'].read()) == raw_data
688+
assert prepped['data'].read() == gzip.compress(raw_data, mtime=None)
690689
assert prepped['headers'].get('content-encoding') == 'gzip'
691690
assert prepped['data'].read() == b''
692691

693692
# Simulate the requests (urllib3) package reading method for binary files.
694693
with tempfile.TemporaryFile(mode='w+b') as tmp_file:
695694
tmp_file.write(raw_data)
696695
tmp_file.seek(0)
697-
698696
prepped = service.prepare_request('GET', url='', data=tmp_file)
699697
compressed = b''
700698
for chunk in prepped['data']:
701699
compressed += chunk
702700

703-
assert gzip.decompress(compressed) == raw_data
701+
assert compressed == gzip.compress(raw_data, mtime=None)
702+
703+
# Make sure the decompression works fine.
704+
assert gzip.decompress(compressed) == raw_data
704705

705706
# Should return file-like object with the compressed data when compression is on
706707
# and the input is a file, opened for reading in text mode.
@@ -711,23 +712,23 @@ def test_gzip_compression_file_input():
711712
tmp_file.seek(0)
712713

713714
prepped = service.prepare_request('GET', url='', data=tmp_file)
714-
assert gzip.decompress(prepped['data'].read()) == text_data.encode()
715+
assert prepped['data'].read() == gzip.compress(text_data.encode(), mtime=None)
715716
assert prepped['headers'].get('content-encoding') == 'gzip'
716717
assert prepped['data'].read() == b''
717718

718719
# Simulate the requests (urllib3) package reading method for text files.
719720
with tempfile.TemporaryFile(mode='w+') as tmp_file:
720721
tmp_file.write(text_data)
721722
tmp_file.seek(0)
722-
723723
prepped = service.prepare_request('GET', url='', data=tmp_file)
724724
compressed = b''
725725
for chunk in prepped['data']:
726726
compressed += chunk
727727

728-
# Make sure the decompression works fine.
729-
assert gzip.decompress(compressed).decode() == text_data
728+
assert compressed == gzip.compress(text_data.encode(), mtime=None)
730729

730+
# Make sure the decompression works fine.
731+
assert gzip.decompress(compressed).decode() == text_data
731732

732733
def test_gzip_compression_external():
733734
# Should set gzip compression from external config

0 commit comments

Comments
 (0)