summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-12-21 11:25:53 +1100
committerDamien George <damien.p.george@gmail.com>2016-12-21 11:25:53 +1100
commit67f3edc10af1833218af680835f75a3e2d0473e7 (patch)
treef1f6edacd79a26f7e25e97684328e426c732bbb6
parent9af73bda33530d4543d81e70be5be34ea398b727 (diff)
downloadmicropython-67f3edc10af1833218af680835f75a3e2d0473e7.tar.gz
micropython-67f3edc10af1833218af680835f75a3e2d0473e7.zip
tests/import: Add a test which uses ... in from-import statement.
-rw-r--r--tests/import/import_pkg7.py2
-rw-r--r--tests/import/pkg7/__init__.py1
-rw-r--r--tests/import/pkg7/mod1.py2
-rw-r--r--tests/import/pkg7/mod2.py2
-rw-r--r--tests/import/pkg7/subpkg1/__init__.py1
-rw-r--r--tests/import/pkg7/subpkg1/subpkg2/__init__.py1
-rw-r--r--tests/import/pkg7/subpkg1/subpkg2/mod3.py4
7 files changed, 13 insertions, 0 deletions
diff --git a/tests/import/import_pkg7.py b/tests/import/import_pkg7.py
new file mode 100644
index 0000000000..be8564ef66
--- /dev/null
+++ b/tests/import/import_pkg7.py
@@ -0,0 +1,2 @@
+# This tests ... relative imports as used in pkg7
+import pkg7.subpkg1.subpkg2.mod3
diff --git a/tests/import/pkg7/__init__.py b/tests/import/pkg7/__init__.py
new file mode 100644
index 0000000000..8b92fa9967
--- /dev/null
+++ b/tests/import/pkg7/__init__.py
@@ -0,0 +1 @@
+print("pkg __name__:", __name__)
diff --git a/tests/import/pkg7/mod1.py b/tests/import/pkg7/mod1.py
new file mode 100644
index 0000000000..6b574114d1
--- /dev/null
+++ b/tests/import/pkg7/mod1.py
@@ -0,0 +1,2 @@
+print('mod1')
+foo = 'mod1.foo'
diff --git a/tests/import/pkg7/mod2.py b/tests/import/pkg7/mod2.py
new file mode 100644
index 0000000000..039a5d1749
--- /dev/null
+++ b/tests/import/pkg7/mod2.py
@@ -0,0 +1,2 @@
+print('mod2')
+bar = 'mod2.bar'
diff --git a/tests/import/pkg7/subpkg1/__init__.py b/tests/import/pkg7/subpkg1/__init__.py
new file mode 100644
index 0000000000..8b92fa9967
--- /dev/null
+++ b/tests/import/pkg7/subpkg1/__init__.py
@@ -0,0 +1 @@
+print("pkg __name__:", __name__)
diff --git a/tests/import/pkg7/subpkg1/subpkg2/__init__.py b/tests/import/pkg7/subpkg1/subpkg2/__init__.py
new file mode 100644
index 0000000000..8b92fa9967
--- /dev/null
+++ b/tests/import/pkg7/subpkg1/subpkg2/__init__.py
@@ -0,0 +1 @@
+print("pkg __name__:", __name__)
diff --git a/tests/import/pkg7/subpkg1/subpkg2/mod3.py b/tests/import/pkg7/subpkg1/subpkg2/mod3.py
new file mode 100644
index 0000000000..b85b34e604
--- /dev/null
+++ b/tests/import/pkg7/subpkg1/subpkg2/mod3.py
@@ -0,0 +1,4 @@
+from ... import mod1
+from ...mod2 import bar
+print(mod1.foo)
+print(bar)