summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/builtin_ord.py
blob: 66e56e5c6fad9962a0809c21a4e8707132155b73 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# test builtin ord (whether or not we support unicode)

print(ord('a'))

try:
    ord('')
except TypeError:
    print("TypeError")

# bytes also work in ord

print(ord(b'a'))
print(ord(b'\x00'))
print(ord(b'\x01'))
print(ord(b'\x7f'))
print(ord(b'\x80'))
print(ord(b'\xff'))

try:
    ord(b'')
except TypeError:
    print("TypeError")