Skip to content

Commit 25c357e

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

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

test/test_base_service.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ def test_http_client():
605605
auth = BasicAuthenticator('my_username', 'my_password')
606606
service = AnyServiceV1('2018-11-20', authenticator=auth)
607607
assert isinstance(service.get_http_client(), requests.sessions.Session)
608-
assert service.get_http_client().headers.get('Accept-Encoding') == 'gzip, deflate'
608+
assert service.get_http_client().headers.get('Accept-Encoding').startswith('gzip, deflate')
609609

610610
new_http_client = requests.Session()
611611
new_http_client.headers.update({'Accept-Encoding': 'gzip'})
@@ -686,7 +686,7 @@ def test_gzip_compression_file_input():
686686
tmp_file.seek(0)
687687

688688
prepped = service.prepare_request('GET', url='', data=tmp_file)
689-
assert prepped['data'].read() == gzip.compress(raw_data)
689+
assert gzip.decompress(prepped['data'].read()) == raw_data
690690
assert prepped['headers'].get('content-encoding') == 'gzip'
691691
assert prepped['data'].read() == b''
692692

@@ -700,10 +700,7 @@ def test_gzip_compression_file_input():
700700
for chunk in prepped['data']:
701701
compressed += chunk
702702

703-
assert compressed == gzip.compress(raw_data)
704-
705-
# Make sure the decompression works fine.
706-
assert gzip.decompress(compressed) == raw_data
703+
assert gzip.decompress(compressed) == raw_data
707704

708705
# Should return file-like object with the compressed data when compression is on
709706
# and the input is a file, opened for reading in text mode.
@@ -714,7 +711,7 @@ def test_gzip_compression_file_input():
714711
tmp_file.seek(0)
715712

716713
prepped = service.prepare_request('GET', url='', data=tmp_file)
717-
assert prepped['data'].read() == gzip.compress(text_data.encode())
714+
assert gzip.decompress(prepped['data'].read()) == text_data.encode()
718715
assert prepped['headers'].get('content-encoding') == 'gzip'
719716
assert prepped['data'].read() == b''
720717

@@ -728,10 +725,8 @@ def test_gzip_compression_file_input():
728725
for chunk in prepped['data']:
729726
compressed += chunk
730727

731-
assert compressed == gzip.compress(text_data.encode())
732-
733-
# Make sure the decompression works fine.
734-
assert gzip.decompress(compressed).decode() == text_data
728+
# Make sure the decompression works fine.
729+
assert gzip.decompress(compressed).decode() == text_data
735730

736731

737732
def test_gzip_compression_external():

0 commit comments

Comments
 (0)