summaryrefslogtreecommitdiff
path: root/Lib/lib2to3
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-07-19 14:19:28 +0000
committerBenjamin Peterson <benjamin@python.org>2008-07-19 14:19:28 +0000
commit0f6de936f81eeb292542aa91a7dfd3fbaf887066 (patch)
treee73b64c43b4a34c72a372be7cd0c33418f1dedef /Lib/lib2to3
parent7d4f39a2ba8dad10569ca450cc080e18ebf50cd0 (diff)
downloadcpython-git-0f6de936f81eeb292542aa91a7dfd3fbaf887066.tar.gz
Merged revisions 65141 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ................ r65141 | benjamin.peterson | 2008-07-19 09:14:06 -0500 (Sat, 19 Jul 2008) | 9 lines Merged revisions 65137 via svnmerge from svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r65137 | georg.brandl | 2008-07-19 08:32:57 -0500 (Sat, 19 Jul 2008) | 2 lines #3334: correctly set prefix of imports. ........ ................
Diffstat (limited to 'Lib/lib2to3')
-rw-r--r--Lib/lib2to3/fixes/fix_import.py2
-rwxr-xr-xLib/lib2to3/tests/test_fixers.py11
2 files changed, 12 insertions, 1 deletions
diff --git a/Lib/lib2to3/fixes/fix_import.py b/Lib/lib2to3/fixes/fix_import.py
index 64397e4337..5612ba6f2c 100644
--- a/Lib/lib2to3/fixes/fix_import.py
+++ b/Lib/lib2to3/fixes/fix_import.py
@@ -45,7 +45,7 @@ class FixImport(fixer_base.BaseFix):
node.changed()
else:
new = FromImport('.', getattr(imp, 'content', None) or [imp])
- new.prefix = node.get_prefix()
+ new.set_prefix(node.get_prefix())
node = new
return node
diff --git a/Lib/lib2to3/tests/test_fixers.py b/Lib/lib2to3/tests/test_fixers.py
index 6d8b34e9ed..dce6f608a2 100755
--- a/Lib/lib2to3/tests/test_fixers.py
+++ b/Lib/lib2to3/tests/test_fixers.py
@@ -3319,6 +3319,17 @@ class Test_import(FixerTestCase):
a = "from . import foo.bar as bang"
self.check_both(b, a)
+ def test_prefix(self):
+ b = """
+ # prefix
+ import foo.bar
+ """
+ a = """
+ # prefix
+ from . import foo.bar
+ """
+ self.check_both(b, a)
+
if __name__ == "__main__":
import __main__