mirror of
https://github.com/kennethreitz/requests3.git
synced 2026-06-05 23:10:16 +00:00
reverting 3357 and comparing properly encoded strings
This commit is contained in:
@@ -1070,18 +1070,13 @@ class TestRequests:
|
||||
# check raise_status falls back to ISO-8859-1
|
||||
r = requests.Response()
|
||||
r.url = 'some url'
|
||||
reason = b'Komponenttia ei l\xf6ydy'
|
||||
r.reason = reason
|
||||
reason = u'Komponenttia ei löydy'
|
||||
r.reason = reason.encode('latin-1')
|
||||
r.status_code = 500
|
||||
r.encoding = None
|
||||
str_error = ''
|
||||
try:
|
||||
with pytest.raises(requests.exceptions.HTTPError) as e:
|
||||
r.raise_for_status()
|
||||
except requests.exceptions.HTTPError as e:
|
||||
str_error = e.args[0]
|
||||
else:
|
||||
raise AssertionError('Expected an HTTPError but it was not raised')
|
||||
assert reason.decode('latin-1') in str_error
|
||||
assert reason in e.value.args[0]
|
||||
|
||||
def test_response_chunk_size_type(self):
|
||||
"""Ensure that chunk_size is passed as None or an integer, otherwise
|
||||
|
||||
Reference in New Issue
Block a user