mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
added tests for ord() in tests/snippets
This commit is contained in:
1 parent
f2922e3f25
commit
7effca3533
1 file changed
+4
@@ -3,7 +3,11 @@ from testutils import assert_raises
|
||||
assert ord("a") == 97
|
||||
assert ord("é") == 233
|
||||
assert ord("🤡") == 129313
|
||||
assert ord(b'a') == 97
|
||||
assert ord(bytearray(b'a')) == 97
|
||||
|
||||
assert_raises(TypeError, lambda: ord(), "ord() is called with no argument")
|
||||
assert_raises(TypeError, lambda: ord(""), "ord() is called with an empty string")
|
||||
assert_raises(TypeError, lambda: ord("ab"), "ord() is called with more than one character")
|
||||
assert_raises(TypeError, lambda: ord(b"ab"), "ord() expected a character, but string of length 2 found")
|
||||
assert_raises(TypeError, lambda: ord(1), "ord() expected a string, bytes or bytearray, but found int")
|
||||
Reference in new issue
Block a user