tests/import: Improve builtinimport.c test coverage.
This commit is contained in:
parent
8d01bd3a1c
commit
50e14ca619
@ -1,2 +1,2 @@
|
|||||||
# This tests ... relative imports as used in pkg7
|
# This tests ... relative imports as used in pkg7 and imports beyond package root
|
||||||
import pkg7.subpkg1.subpkg2.mod3
|
import pkg7.subpkg1.subpkg2.mod3
|
||||||
|
2
tests/import/import_pkg8.py
Normal file
2
tests/import/import_pkg8.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# import with no __init__.py files
|
||||||
|
import pkg8.mod
|
@ -2,3 +2,10 @@ from ... import mod1
|
|||||||
from ...mod2 import bar
|
from ...mod2 import bar
|
||||||
print(mod1.foo)
|
print(mod1.foo)
|
||||||
print(bar)
|
print(bar)
|
||||||
|
|
||||||
|
# when attempting relative import beyond top-level package uPy raises ImportError
|
||||||
|
# whereas CPython raises a ValueError
|
||||||
|
try:
|
||||||
|
from .... import mod1
|
||||||
|
except (ImportError, ValueError):
|
||||||
|
print('Error')
|
||||||
|
1
tests/import/pkg8/mod.py
Normal file
1
tests/import/pkg8/mod.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
print('foo')
|
Loading…
Reference in New Issue
Block a user