mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 19:20:22 +01:00
tests/import: Add a test for the builtin __import__ function.
This commit is contained in:
16
tests/import/builtin_import.py
Normal file
16
tests/import/builtin_import.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# test calling builtin import function
|
||||
|
||||
# basic test
|
||||
__import__('builtins')
|
||||
|
||||
# first arg should be a string
|
||||
try:
|
||||
__import__(1)
|
||||
except TypeError:
|
||||
print('TypeError')
|
||||
|
||||
# level argument should be non-negative
|
||||
try:
|
||||
__import__('xyz', None, None, None, -1)
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
Reference in New Issue
Block a user