summaryrefslogtreecommitdiff
path: root/tests/micropython
diff options
context:
space:
mode:
Diffstat (limited to 'tests/micropython')
-rw-r--r--tests/micropython/native_fun_attrs_code.py21
-rw-r--r--tests/micropython/native_fun_attrs_code.py.exp1
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/micropython/native_fun_attrs_code.py b/tests/micropython/native_fun_attrs_code.py
new file mode 100644
index 000000000..d277a7b9b
--- /dev/null
+++ b/tests/micropython/native_fun_attrs_code.py
@@ -0,0 +1,21 @@
+# Test MicroPython-specific restrictions of function.__code__ attribute.
+
+try:
+ (lambda: 0).__code__
+except AttributeError:
+ print("SKIP")
+ raise SystemExit
+
+import micropython
+
+
+@micropython.native
+def f_native():
+ pass
+
+
+# Can't access __code__ when function is native code.
+try:
+ f_native.__code__
+except AttributeError:
+ print("AttributeError")
diff --git a/tests/micropython/native_fun_attrs_code.py.exp b/tests/micropython/native_fun_attrs_code.py.exp
new file mode 100644
index 000000000..d169edffb
--- /dev/null
+++ b/tests/micropython/native_fun_attrs_code.py.exp
@@ -0,0 +1 @@
+AttributeError