diff options
Diffstat (limited to 'tests/micropython/native_fun_attrs.py')
-rw-r--r-- | tests/micropython/native_fun_attrs.py | 25 |
1 files changed, 25 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") |