-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core] remove chardet dep from azure.core.rest #19962
Changes from all commits
a13b248
2c9d57b
9de3b62
2be52d4
916aafc
a7a1a85
d4c38a7
be24aa7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,7 +138,7 @@ def test_response_no_charset_with_ascii_content(send_request): | |
|
||
assert response.headers["Content-Type"] == "text/plain" | ||
assert response.status_code == 200 | ||
assert response.encoding == 'ascii' | ||
assert response.encoding is None | ||
assert response.text == "Hello, world!" | ||
|
||
|
||
|
@@ -151,7 +151,7 @@ def test_response_no_charset_with_iso_8859_1_content(send_request): | |
request=HttpRequest("GET", "/encoding/iso-8859-1"), | ||
) | ||
assert response.text == u"Accented: Österreich" | ||
assert response.encoding == 'ISO-8859-1' | ||
assert response.encoding is None | ||
|
||
def test_response_set_explicit_encoding(send_request): | ||
# Deliberately incorrect charset | ||
|
@@ -168,7 +168,7 @@ def test_json(send_request): | |
request=HttpRequest("GET", "/basic/json"), | ||
) | ||
assert response.json() == {"greeting": "hello", "recipient": "world"} | ||
assert response.encoding == 'utf-8-sig' # for requests, we use utf-8-sig instead of utf-8 bc of requests behavior | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still need these three tests? Maybe one is good enought? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not quite sure which tests you mean by the three tests, but I feel like more tests is better, so might as well not get rid of them |
||
assert response.encoding is None | ||
|
||
def test_json_with_specified_encoding(send_request): | ||
response = send_request( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to default to "utf-8"("utf-8-sig"), right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After talking with @lmazuel, we don't default the value of
self.encoding
toutf-8-sig
. We do that when we're deserializing for thetext
property, which I've added code for indef decode_to_text