aboutsummaryrefslogtreecommitdiff
path: root/tests/import
diff options
context:
space:
mode:
authorDamien George2017-01-16 16:57:00 +1100
committerDamien George2017-06-28 12:21:29 +1000
commit3a9445c6b3053d492c12bbf808d251c6da55632a (patch)
treeedbf421cdaa877db1ece2dddce419735ce3d9d77 /tests/import
parent2f7fad66a2b3d51772854575b080518c92eefde8 (diff)
tests/import: Add a test for the builtin __import__ function.
Diffstat (limited to 'tests/import')
-rw-r--r--tests/import/builtin_import.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/import/builtin_import.py b/tests/import/builtin_import.py
new file mode 100644
index 000000000..088f631fc
--- /dev/null
+++ b/tests/import/builtin_import.py
@@ -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')