8000 [mypyc] Add tests for chr(), ord(), encode() and decode() by 97littleleaf11 · Pull Request #10914 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

[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

Merged
merged 7 commits into from
Aug 5, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add more tests
  • Loading branch information
97littleleaf11 committed Aug 3, 2021
commit 6f3dc2e866df79d281a987deda334ae1117c49bb
10 changes: 8 additions & 2 deletions mypyc/test-data/run-strings.test
Original file line number Diff line number Diff line change
Expand Up @@ -513,12 +513,13 @@ def test_format_method_python_doc() -> None:
' 11 B 13 1011']

[case testUnicodeEncodeDecode]

# https://docs.python.org/3/howto/unicode.html
# Some test cases are from https://docs.python.org/3/howto/unicode.html

def test_chr() -> None:
assert chr(57344) == '\ue000'
assert chr(0) == '\x00'
assert chr(65) == 'A'
assert chr(150) == '\x96'
try:
chr(-1)
assert False
Expand All @@ -530,6 +531,8 @@ def test_chr() -> None:
except ValueError:
pass
assert chr(1114111) == '\U0010ffff'
x = 100
assert chr(x + int()) == 'd'

def test_ord() -> None:
assert ord('\ue000') == 57344
Expand All @@ -542,6 +545,9 @@ def test_ord() -> None:
u = 'abcdé'
assert ord(u[-1]) == 233
assert ord(b'a') == 97
assert ord(b'a' + bytes()) == 97
u2 = '\U0010ffff'
assert ord(u2) == 1114111
try:
ord('aa')
assert False
Expand Down
0