builtin_import.py 305 B

12345678910111213141516
  1. # test calling builtin import function
  2. # basic test
  3. __import__('builtins')
  4. # first arg should be a string
  5. try:
  6. __import__(1)
  7. except TypeError:
  8. print('TypeError')
  9. # level argument should be non-negative
  10. try:
  11. __import__('xyz', None, None, None, -1)
  12. except ValueError:
  13. print('ValueError')