diff options
Diffstat (limited to 'Lib/test/test_import.py')
-rw-r--r-- | Lib/test/test_import.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index b89f09b393..72f27fad90 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -192,3 +192,16 @@ def test_failing_reload(): del sys.modules[TESTFN] test_failing_reload() + +def test_import_name_binding(): + # import x.y.z binds x in the current namespace + import test as x + import test.test_support + assert x is test, x.__name__ + assert hasattr(test.test_support, "__file__") + + # import x.y.z as w binds z as w + import test.test_support as y + assert y is test.test_support, y.__name__ + +test_import_name_binding() |