mirror of
https://github.com/python/cpython.git
synced 2025-08-01 23:53:15 +00:00
Issue #2400: Allow relative imports to "import *".
This commit is contained in:
parent
de48d8406f
commit
a4d77898db
4 changed files with 16 additions and 5 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue