-
-
Notifications
You must be signed in to change notification settings - Fork 3k
[mypyc] Add tests for chr(), ord(), encode() and decode() #10914
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
Conversation
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.
Left some ideas about further things to test.
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.
Thanks for the updates! Left a few additional ideas.
assert "\U00000394" == '\u0394' | ||
assert b'\x80abc'.decode("utf-8", "replace") == '\ufffdabc' | ||
assert b'\x80abc'.decode("utf-8", "backslashreplace") == '\\x80abc' | ||
assert b'\x80abc'.decode("utf-8", "ignore") == 'abc' |
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.
A few more ideas: Test decode exception, test latin1
, test some different spellings (utf8
, utf_8
and Utf-8
all seem to work).
assert u.encode('ascii', 'xmlcharrefreplace') == b'ꀀabcd޴' | ||
assert u.encode('ascii', 'backslashreplace') == b'\\ua000abcd\\u07b4' | ||
assert u.encode('ascii', 'namereplace') == b'\\N{YI SYLLABLE IT}abcd\\u07b4' | ||
assert 'pythön!'.encode() == b'pyth\xc3\xb6n!' |
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.
Test latin1
, test some different spellings (as above).
Also please update the name of the PR to mention |
Can you rebase? This should fix CI. |
…de-decode-tests
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.
Looks good now!
Description
Add several run tests:
chr()
ord()
decode()
encode()