diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2020-04-28 13:43:07 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-05-02 17:41:04 +1000 |
commit | 309c19d39b8d7556ef60d8a7545978ba8f77ecfe (patch) | |
tree | 47f457e09389c6930991574afd565c47b3548067 /tests | |
parent | 73c58150f53d9d828c4fc8fb455cca6831eb8ddd (diff) | |
download | micropython-309c19d39b8d7556ef60d8a7545978ba8f77ecfe.tar.gz micropython-309c19d39b8d7556ef60d8a7545978ba8f77ecfe.zip |
tests/cpydiff: Add cpydiff test for __all__ used in imported package.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cpydiff/core_import_all.py | 9 | ||||
-rw-r--r-- | tests/cpydiff/modules3/__init__.py | 1 | ||||
-rw-r--r-- | tests/cpydiff/modules3/foo.py | 2 |
3 files changed, 12 insertions, 0 deletions
diff --git a/tests/cpydiff/core_import_all.py b/tests/cpydiff/core_import_all.py new file mode 100644 index 0000000000..5adf9ae3eb --- /dev/null +++ b/tests/cpydiff/core_import_all.py @@ -0,0 +1,9 @@ +""" +categories: Core,import +description: __all__ is unsupported in __init__.py in MicroPython. +cause: Not implemented. +workaround: Manually import the sub-modules directly in __init__.py using ``from . import foo, bar``. +""" +from modules3 import * + +foo.hello() diff --git a/tests/cpydiff/modules3/__init__.py b/tests/cpydiff/modules3/__init__.py new file mode 100644 index 0000000000..27a2bf2ad9 --- /dev/null +++ b/tests/cpydiff/modules3/__init__.py @@ -0,0 +1 @@ +__all__ = ["foo"] diff --git a/tests/cpydiff/modules3/foo.py b/tests/cpydiff/modules3/foo.py new file mode 100644 index 0000000000..dd9b9d4ddd --- /dev/null +++ b/tests/cpydiff/modules3/foo.py @@ -0,0 +1,2 @@ +def hello(): + print("hello") |