diff --git a/IPython/core/tests/test_oinspect.py b/IPython/core/tests/test_oinspect.py index 0c71f00..e868730 100644 --- a/IPython/core/tests/test_oinspect.py +++ b/IPython/core/tests/test_oinspect.py @@ -172,6 +172,19 @@ class Awkward(object): def __getattr__(self, name): raise Exception(name) +class NoBoolCall: + """ + callable with `__bool__` raising should still be inspect-able. + """ + + def __call__(self): + """does nothing""" + pass + + def __bool__(self): + """just raise NotImplemented""" + raise NotImplementedError('Must be implemented') + def check_calltip(obj, name, call, docstring): """Generic check pattern all calltip tests will use""" @@ -281,6 +294,9 @@ def test_info_awkward(): # Just test that this doesn't throw an error. i = inspector.info(Awkward()) +def test_bool_raise(): + inspector.info(NoBoolCall()) + def test_calldef_none(): # We should ignore __call__ for all of these. for obj in [f, SimpleClass().method, any, str.upper]: