summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rebuilder.py6
-rw-r--r--test/unittest_builder.py14
2 files changed, 7 insertions, 13 deletions
diff --git a/rebuilder.py b/rebuilder.py
index 76843e2..fbfad7b 100644
--- a/rebuilder.py
+++ b/rebuilder.py
@@ -22,10 +22,10 @@
"""this module contains utilities for rebuilding a compiler.ast
or _ast tree in order to get a single ASTNG representation
"""
+from logilab.astng import ASTNGBuildingException, InferenceError
+from logilab.astng import nodes
from logilab.astng.utils import ASTVisitor
from logilab.astng.raw_building import *
-from logilab.astng._exceptions import ASTNGBuildingException, InferenceError
-from logilab.astng import nodes
from logilab.astng.nodes_as_string import as_string
@@ -221,8 +221,8 @@ class RebuildVisitor(ASTVisitor):
const = nodes.const_factory(value)
const.parent = node
node.locals[name] = [const]
+ attach___dict__(node)
if node.package:
- # FIXME: List(Const())
const = nodes.const_factory(value)
const.parent = node
node.locals['__path__'] = [const]
diff --git a/test/unittest_builder.py b/test/unittest_builder.py
index 1575c90..d03eb88 100644
--- a/test/unittest_builder.py
+++ b/test/unittest_builder.py
@@ -223,19 +223,13 @@ class BuilderTC(TestCase):
self.assertEquals(len(infered), 1)
infered = infered[0]
self.assertEquals(infered.name, 'object')
- try:
- as_string(infered)
- except:
- print repr(infered)
+ as_string(infered)
infered = list(builtin_astng.igetattr('type'))
self.assertEquals(len(infered), 1)
infered = infered[0]
self.assertEquals(infered.name, 'type')
- try:
- as_string(infered)
- except:
- print repr(infered)
+ as_string(infered)
def test_package_name(self):
"""test base properties and method of a astng module"""
@@ -354,11 +348,11 @@ class FileBuildTC(TestCase):
"""test the 'locals' dictionary of a astng module"""
module = self.module
_locals = module.locals
- self.assertEquals(len(_locals), 19)
+ self.assertEquals(len(_locals), 20)
self.assert_(_locals is module.globals)
keys = _locals.keys()
keys.sort()
- should = ['MY_DICT', 'YO', 'YOUPI', '__doc__', '__file__', '__name__',
+ should = ['MY_DICT', 'YO', 'YOUPI', '__dict__', '__doc__', '__file__', '__name__',
'__revision__', 'global_access','modutils', 'nested_args',
'os', 'redirect', 'spawn', 'REDIRECT', 'LocalsVisitor',
'ASTWalker', 'ASTVisitor', 'are_exclusive', 'extend_class']