circuitpython/tests/basics/builtin_override.py
Paul Sokolovsky 83623b2fde tests/basic/[a-f]*: Make skippable.
For small ports which don't have all features enabled.
2017-02-15 00:57:56 +03:00

20 lines
325 B
Python

# test overriding builtins
import builtins
# override generic builtin
try:
builtins.abs = lambda x: x + 1
except AttributeError:
import sys
print("SKIP")
sys.exit()
print(abs(1))
# __build_class__ is handled in a special way
builtins.__build_class__ = lambda x, y: ('class', y)
class A:
pass
print(A)