summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/micropython/native_fun_attrs.py25
-rw-r--r--tests/micropython/native_fun_attrs.py.exp4
-rwxr-xr-xtests/run-tests.py1
3 files changed, 30 insertions, 0 deletions
diff --git a/tests/micropython/native_fun_attrs.py b/tests/micropython/native_fun_attrs.py
new file mode 100644
index 000000000..e61c86975
--- /dev/null
+++ b/tests/micropython/native_fun_attrs.py
@@ -0,0 +1,25 @@
+# test native function attributes
+
+
+def f():
+ pass
+
+
+if not hasattr(f, "__name__"):
+ print("SKIP")
+ raise SystemExit
+
+
+@micropython.native
+def native_f():
+ pass
+
+
+print(type(native_f.__name__))
+print(type(native_f.__globals__))
+print(native_f.__globals__ is globals())
+
+try:
+ native_f.__name__ = None
+except AttributeError:
+ print("AttributeError")
diff --git a/tests/micropython/native_fun_attrs.py.exp b/tests/micropython/native_fun_attrs.py.exp
new file mode 100644
index 000000000..8be35e2f6
--- /dev/null
+++ b/tests/micropython/native_fun_attrs.py.exp
@@ -0,0 +1,4 @@
+<class 'str'>
+<class 'dict'>
+True
+AttributeError
diff --git a/tests/run-tests.py b/tests/run-tests.py
index 7377e8ae2..2d6dbaaf1 100755
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -603,6 +603,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
skip_tests.add("basics/del_deref.py") # requires checking for unbound local
skip_tests.add("basics/del_local.py") # requires checking for unbound local
skip_tests.add("basics/exception_chain.py") # raise from is not supported
+ skip_tests.add("basics/fun_name.py") # requires proper names for native functions
skip_tests.add("basics/scope_implicit.py") # requires checking for unbound local
skip_tests.add("basics/sys_tracebacklimit.py") # requires traceback info
skip_tests.add("basics/try_finally_return2.py") # requires raise_varargs