diff options
| author | Damien George <damien.p.george@gmail.com> | 2017-01-16 16:57:00 +1100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2017-06-28 12:21:29 +1000 |
| commit | 3a9445c6b3053d492c12bbf808d251c6da55632a (patch) | |
| tree | edbf421cdaa877db1ece2dddce419735ce3d9d77 | |
| parent | 2f7fad66a2b3d51772854575b080518c92eefde8 (diff) | |
tests/import: Add a test for the builtin __import__ function.
| -rw-r--r-- | tests/import/builtin_import.py | 16 |
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') |
