From 67f3edc10af1833218af680835f75a3e2d0473e7 Mon Sep 17 00:00:00 2001 From: Damien George <damien.p.george@gmail.com> Date: Wed, 21 Dec 2016 11:25:53 +1100 Subject: [PATCH] tests/import: Add a test which uses ... in from-import statement. --- tests/import/import_pkg7.py | 2 ++ tests/import/pkg7/__init__.py | 1 + tests/import/pkg7/mod1.py | 2 ++ tests/import/pkg7/mod2.py | 2 ++ tests/import/pkg7/subpkg1/__init__.py | 1 + tests/import/pkg7/subpkg1/subpkg2/__init__.py | 1 + tests/import/pkg7/subpkg1/subpkg2/mod3.py | 4 ++++ 7 files changed, 13 insertions(+) create mode 100644 tests/import/import_pkg7.py create mode 100644 tests/import/pkg7/__init__.py create mode 100644 tests/import/pkg7/mod1.py create mode 100644 tests/import/pkg7/mod2.py create mode 100644 tests/import/pkg7/subpkg1/__init__.py create mode 100644 tests/import/pkg7/subpkg1/subpkg2/__init__.py create mode 100644 tests/import/pkg7/subpkg1/subpkg2/mod3.py diff --git a/tests/import/import_pkg7.py b/tests/import/import_pkg7.py new file mode 100644 index 000000000..be8564ef6 --- /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 000000000..8b92fa996 --- /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 000000000..6b574114d --- /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 000000000..039a5d174 --- /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 000000000..8b92fa996 --- /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 000000000..8b92fa996 --- /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 000000000..b85b34e60 --- /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) -- GitLab