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()
Core and builtins
-----------------
+- Issue #2400: Allow relative imports to "import *".
+
- Issue 1745. Backport print function with:
from __future__ import print_function
/* from ... import * */
n = CHILD(n, idx);
n_children = 1;
- if (ndots) {
- ast_error(n, "'import *' not allowed with 'from .'");
- return NULL;
- }
break;
case LPAR:
/* from ... import (x, y, z) */