mirror of
https://github.com/python/cpython.git
synced 2025-10-23 09:53:47 +00:00

attribute. Was throwing AttributeError before. Discovered when running test_builtin against importlib. This exception change is specific to importlib.__import__() and does not apply to import_module() as it is being done for compatibility reasons only.
22 lines
531 B
Python
22 lines
531 B
Python
from . import util
|
|
import unittest
|
|
|
|
|
|
class APITest(unittest.TestCase):
|
|
|
|
"""Test API-specific details for __import__ (e.g. raising the right
|
|
exception when passing in an int for the module name)."""
|
|
|
|
def test_name_requires_rparition(self):
|
|
# Raise TypeError if a non-string is passed in for the module name.
|
|
with self.assertRaises(TypeError):
|
|
util.import_(42)
|
|
|
|
|
|
def test_main():
|
|
from test.support import run_unittest
|
|
run_unittest(APITest)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
test_main()
|