From 289ddab5f77f6734be6f7fc3f3d88ef838f962f8 Mon Sep 17 00:00:00 2001 From: BLUELOVETH Date: Mon, 28 Aug 2023 13:40:39 +0800 Subject: [PATCH] ... --- tests/30_import.py | 6 +++++- tests/test2/a/__init__.py | 2 -- tests/test2/a/g/__init__.py | 2 ++ tests/test2/utils/r.py | 2 +- tests/test3/__init__.py | 3 +++ tests/test3/a/__init__.py | 3 +++ tests/test3/a/b.py | 1 + 7 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 tests/test3/__init__.py create mode 100644 tests/test3/a/__init__.py create mode 100644 tests/test3/a/b.py diff --git a/tests/30_import.py b/tests/30_import.py index a7f6d0ff..fc420840 100644 --- a/tests/30_import.py +++ b/tests/30_import.py @@ -14,4 +14,8 @@ import test2 assert test2.a.g.get_value() == '123' from test2.utils import get_value_2 -assert get_value_2() == '123' \ No newline at end of file +assert get_value_2() == '123' + +from test3.a.b import value +# should test3 +assert value == 1 \ No newline at end of file diff --git a/tests/test2/a/__init__.py b/tests/test2/a/__init__.py index c2b30cc1..d0396b19 100644 --- a/tests/test2/a/__init__.py +++ b/tests/test2/a/__init__.py @@ -1,3 +1 @@ -ok = True - from ..b import D \ No newline at end of file diff --git a/tests/test2/a/g/__init__.py b/tests/test2/a/g/__init__.py index ff8d2052..1c8290b8 100644 --- a/tests/test2/a/g/__init__.py +++ b/tests/test2/a/g/__init__.py @@ -1,3 +1,5 @@ +ok = True + from ...utils import r def get_value(): diff --git a/tests/test2/utils/r.py b/tests/test2/utils/r.py index 33dbd4c5..91255f69 100644 --- a/tests/test2/utils/r.py +++ b/tests/test2/utils/r.py @@ -1,4 +1,4 @@ value = '123' from test2.a import g -assert g.ok == True +assert g.ok diff --git a/tests/test3/__init__.py b/tests/test3/__init__.py new file mode 100644 index 00000000..b6acfe8e --- /dev/null +++ b/tests/test3/__init__.py @@ -0,0 +1,3 @@ +raise ValueError( + "test3 should not be imported" +) \ No newline at end of file diff --git a/tests/test3/a/__init__.py b/tests/test3/a/__init__.py new file mode 100644 index 00000000..260dabcc --- /dev/null +++ b/tests/test3/a/__init__.py @@ -0,0 +1,3 @@ +raise ValueError( + "test3.a should not be imported" +) \ No newline at end of file diff --git a/tests/test3/a/b.py b/tests/test3/a/b.py new file mode 100644 index 00000000..b7181258 --- /dev/null +++ b/tests/test3/a/b.py @@ -0,0 +1 @@ +value = 1 \ No newline at end of file