Skip to content

Commit 7effca3

Browse files
committed
added tests for ord() in tests/snippets
1 parent f2922e3 commit 7effca3

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

tests/snippets/builtin_ord.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
assert ord("a") == 97
44
assert ord("é") == 233
55
assert ord("🤡") == 129313
6+
assert ord(b'a') == 97
7+
assert ord(bytearray(b'a')) == 97
68

79
assert_raises(TypeError, lambda: ord(), "ord() is called with no argument")
810
assert_raises(TypeError, lambda: ord(""), "ord() is called with an empty string")
911
assert_raises(TypeError, lambda: ord("ab"), "ord() is called with more than one character")
12+
assert_raises(TypeError, lambda: ord(b"ab"), "ord() expected a character, but string of length 2 found")
13+
assert_raises(TypeError, lambda: ord(1), "ord() expected a string, bytes or bytearray, but found int")

0 commit comments

Comments
 (0)