Skip to content
Myr

Merge pull request #3557 from sigmavirus24/fix-failing-test

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix how we test fallback to latin-1 reason encoding

authored by Cory Benfield · committed by GitHub · parents 87f9693, 42d4eaf · Browse files · 1 file+3 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−3 removed

  • tests:+3 added−3 removed

1 file+3 added−3 removed

modified:tests/test_requests.py+3 added-3 removed
1024 unmodified lines
1025 def test_response_reason_unicode_fallback(self):1026 # check raise_status falls back to ISO-8859-11027 r = requests.Response()1028 r.url = 'some url'1029 reason = u'Komponenttia ei löydy'1030 r.reason = reason.encode('latin-1')1029 reason = b'Komponenttia ei l\xf6ydy'1030 r.reason = reason1031 r.status_code = 5001032 r.encoding = None1033 with pytest.raises(requests.exceptions.HTTPError) as e:1034 r.raise_for_status()1035 assert reason in str(e)1035 assert reason.decode('latin-1') in str(e)10361037 def test_response_chunk_size_type(self):1038 """Ensure that chunk_size is passed as None or an integer, otherwise1039 raise a TypeError.
797 unmodified lines