diff options
| author | Emile Anclin <emile.anclin@logilab.fr> | 2010-12-08 10:35:53 +0100 |
|---|---|---|
| committer | Emile Anclin <emile.anclin@logilab.fr> | 2010-12-08 10:35:53 +0100 |
| commit | e997206801738d624e5bb49bf90e88188f26b0f7 (patch) | |
| tree | 06495df9ae61a2ca85ef2f888756573962209e00 /as_string.py | |
| parent | 1bfd055441923d806b533eca4676db9408845cf3 (diff) | |
| download | astroid-git-e997206801738d624e5bb49bf90e88188f26b0f7.tar.gz | |
as_string: fix explicit relative imports; add test
Diffstat (limited to 'as_string.py')
| -rw-r--r-- | as_string.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/as_string.py b/as_string.py index 61ce44e0..62ab5e84 100644 --- a/as_string.py +++ b/as_string.py @@ -228,8 +228,8 @@ class AsStringVisitor(object): def visit_from(self, node): """return an astng.From node as string""" - modname = node.modname or '.' * node.level - return 'from %s import %s' % (modname, _import_string(node.names)) + return 'from %s import %s' % ('.' * (node.level or 0) + node.modname, + _import_string(node.names)) def visit_function(self, node): """return an astng.Function node as string""" |
