tests/import: Add a test for the builtin __import__ function.

This commit is contained in:
Damien George 2017-01-16 16:57:00 +11:00
parent 2f7fad66a2
commit 3a9445c6b3
1 changed files with 16 additions and 0 deletions

View 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')