summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSylvain Thénault <sylvain.thenault@logilab.fr>2014-04-08 14:07:46 +0200
committerSylvain Thénault <sylvain.thenault@logilab.fr>2014-04-08 14:07:46 +0200
commit147e785eb915d8ae7e8dcad334a7b6f6a8f769be (patch)
tree352ff5d0ddc5fa597dd7a7e6c10ca8fb183aa4a1 /test
parentc3de2291e6c674e4a467563c890736d63e4c9d87 (diff)
downloadastroid-git-147e785eb915d8ae7e8dcad334a7b6f6a8f769be.tar.gz
fix crash when class has some __call__ method that is not inferable. Closes #17
Diffstat (limited to 'test')
-rw-r--r--test/unittest_scoped_nodes.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/unittest_scoped_nodes.py b/test/unittest_scoped_nodes.py
index e51fee11..0489b209 100644
--- a/test/unittest_scoped_nodes.py
+++ b/test/unittest_scoped_nodes.py
@@ -27,7 +27,7 @@ from textwrap import dedent
from logilab.common.testlib import TestCase, unittest_main, require_version
-from astroid import builder, nodes, scoped_nodes, \
+from astroid import YES, builder, nodes, scoped_nodes, \
InferenceError, NotFoundError, NoDefault
from astroid.bases import BUILTINS, Instance, BoundMethod, UnboundMethod
from astroid.test_utils import extract_node
@@ -746,6 +746,22 @@ def g2():
self.assertIsInstance(metaclass, scoped_nodes.Class)
self.assertEqual(metaclass.name, 'ABCMeta')
+ def test_nonregr_infer_callresult(self):
+ astroid = abuilder.string_build(dedent("""
+ class Delegate(object):
+ def __get__(self, obj, cls):
+ return getattr(obj._subject, self.attribute)
+
+ class CompositeBuilder(object):
+ __call__ = Delegate()
+
+ builder = CompositeBuilder(result, composite)
+ tgts = builder()
+ """))
+ instance = astroid['tgts']
+ # used to raise "'_Yes' object is not iterable", see
+ # https://bitbucket.org/logilab/astroid/issue/17
+ self.assertEqual(list(instance.infer()), [YES])
__all__ = ('ModuleNodeTC', 'ImportNodeTC', 'FunctionNodeTC', 'ClassNodeTC')