diff options
author | Thomas Wouters <thomas@python.org> | 2006-05-25 11:26:25 (GMT) |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2006-05-25 11:26:25 (GMT) |
commit | 143bdfcee6c3b3a4b688a7c9fca28a14d775c4e2 (patch) | |
tree | d9cdea8862609b766b3d410c0ae3dc02535f2994 /Lib | |
parent | cf8229ea3b0c0f56d261074bd9eb18b459ff8a8a (diff) | |
download | cpython-143bdfcee6c3b3a4b688a7c9fca28a14d775c4e2.zip cpython-143bdfcee6c3b3a4b688a7c9fca28a14d775c4e2.tar.gz cpython-143bdfcee6c3b3a4b688a7c9fca28a14d775c4e2.tar.bz2 |
Update graminit.c for the fix for #1488915, Multiple dots in relative import
statement raise SyntaxError, and add testcase.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_importhooks.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/test/test_importhooks.py b/Lib/test/test_importhooks.py index 0693581..e8b4695 100644 --- a/Lib/test/test_importhooks.py +++ b/Lib/test/test_importhooks.py @@ -14,6 +14,7 @@ def get_file(): absimp = "import sub\n" relimp = "from . import sub\n" +deeprelimp = "from .... import sub\n" futimp = "from __future__ import absolute_import\n" reload_src = test_src+"""\ @@ -26,6 +27,7 @@ reload_co = compile(reload_src, "<???>", "exec") test2_oldabs_co = compile(absimp + test_src, "<???>", "exec") test2_newabs_co = compile(futimp + absimp + test_src, "<???>", "exec") test2_newrel_co = compile(relimp + test_src, "<???>", "exec") +test2_deeprel_co = compile(deeprelimp + test_src, "<???>", "exec") test2_futrel_co = compile(futimp + relimp + test_src, "<???>", "exec") test_path = "!!!_test_!!!" @@ -46,10 +48,11 @@ class TestImporter: "hooktestmodule": (False, test_co), "hooktestpackage": (True, test_co), "hooktestpackage.sub": (True, test_co), - "hooktestpackage.sub.subber": (False, test_co), + "hooktestpackage.sub.subber": (True, test_co), "hooktestpackage.oldabs": (False, test2_oldabs_co), "hooktestpackage.newabs": (False, test2_newabs_co), "hooktestpackage.newrel": (False, test2_newrel_co), + "hooktestpackage.sub.subber.subest": (True, test2_deeprel_co), "hooktestpackage.futrel": (False, test2_futrel_co), "sub": (False, test_co), "reloadmodule": (False, test_co), @@ -203,6 +206,12 @@ class ImportHooksTestCase(ImportHooksBaseTestCase): self.assertEqual(hooktestpackage.newrel.sub, hooktestpackage.sub) + import hooktestpackage.sub.subber.subest as subest + self.assertEqual(subest.get_name(), + "hooktestpackage.sub.subber.subest") + self.assertEqual(subest.sub, + hooktestpackage.sub) + import hooktestpackage.futrel self.assertEqual(hooktestpackage.futrel.get_name(), "hooktestpackage.futrel") |