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

pull/2795/head
Damien George 2017-01-16 16:57:00 +11:00
rodzic 2f7fad66a2
commit 3a9445c6b3
1 zmienionych plików z 16 dodań i 0 usunięć

Wyświetl plik

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