diff options
| author | Martin v. Löwis <martin@v.loewis.de> | 2008-03-19 04:39:13 (GMT) |
|---|---|---|
| committer | Martin v. Löwis <martin@v.loewis.de> | 2008-03-19 04:39:13 (GMT) |
| commit | a4d77898db3856cd3d8c9411d024bea88be25b66 (patch) | |
| tree | da46cbbc8815fe69cadc7a44146970a56439b05c /Lib/test/test_import.py | |
| parent | de48d8406feb997fefdbad7fbdbf43f918805f2e (diff) | |
| download | cpython-a4d77898db3856cd3d8c9411d024bea88be25b66.zip cpython-a4d77898db3856cd3d8c9411d024bea88be25b66.tar.gz cpython-a4d77898db3856cd3d8c9411d024bea88be25b66.tar.bz2 | |
Issue #2400: Allow relative imports to "import *".
Diffstat (limited to 'Lib/test/test_import.py')
| -rw-r--r-- | Lib/test/test_import.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index a44170c..dfaad29 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -254,8 +254,20 @@ class PathsTests(unittest.TestCase): self.assertEqual(mod.testdata, 'test_trailing_slash') unload("test_trailing_slash") +class RelativeImport(unittest.TestCase): + def tearDown(self): + try: + del sys.modules["test.relimport"] + except: + pass + + def test_relimport_star(self): + # This will import * from .test_import. + import relimport + self.assertTrue(hasattr(relimport, "RelativeImport")) + def test_main(verbose=None): - run_unittest(ImportTest, PathsTests) + run_unittest(ImportTest, PathsTests, RelativeImport) if __name__ == '__main__': test_main() |
