micropython: add micropython component
This commit is contained in:
28
components/language/micropython/tests/basics/builtin_ord.py
Normal file
28
components/language/micropython/tests/basics/builtin_ord.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# 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")
|
||||
|
||||
# argument must be a string
|
||||
try:
|
||||
ord(1)
|
||||
except TypeError:
|
||||
print('TypeError')
|
Reference in New Issue
Block a user