Show More
@@ -832,7 +832,7 b' class Inspector:' | |||||
832 | else: |
|
832 | else: | |
833 | callable_obj = None |
|
833 | callable_obj = None | |
834 |
|
834 | |||
835 | if callable_obj: |
|
835 | if callable_obj is not None: | |
836 | try: |
|
836 | try: | |
837 | argspec = getargspec(callable_obj) |
|
837 | argspec = getargspec(callable_obj) | |
838 | except (TypeError, AttributeError): |
|
838 | except (TypeError, AttributeError): |
@@ -172,6 +172,19 b' class Awkward(object):' | |||||
172 | def __getattr__(self, name): |
|
172 | def __getattr__(self, name): | |
173 | raise Exception(name) |
|
173 | raise Exception(name) | |
174 |
|
174 | |||
|
175 | class NoBoolCall: | |||
|
176 | """ | |||
|
177 | callable with `__bool__` raising should still be inspect-able. | |||
|
178 | """ | |||
|
179 | ||||
|
180 | def __call__(self): | |||
|
181 | """does nothing""" | |||
|
182 | pass | |||
|
183 | ||||
|
184 | def __bool__(self): | |||
|
185 | """just raise NotImplemented""" | |||
|
186 | raise NotImplementedError('Must be implemented') | |||
|
187 | ||||
175 |
|
188 | |||
176 | def check_calltip(obj, name, call, docstring): |
|
189 | def check_calltip(obj, name, call, docstring): | |
177 | """Generic check pattern all calltip tests will use""" |
|
190 | """Generic check pattern all calltip tests will use""" | |
@@ -281,6 +294,9 b' def test_info_awkward():' | |||||
281 | # Just test that this doesn't throw an error. |
|
294 | # Just test that this doesn't throw an error. | |
282 | i = inspector.info(Awkward()) |
|
295 | i = inspector.info(Awkward()) | |
283 |
|
296 | |||
|
297 | def test_bool_raise(): | |||
|
298 | inspector.info(NoBoolCall()) | |||
|
299 | ||||
284 | def test_calldef_none(): |
|
300 | def test_calldef_none(): | |
285 | # We should ignore __call__ for all of these. |
|
301 | # We should ignore __call__ for all of these. | |
286 | for obj in [f, SimpleClass().method, any, str.upper]: |
|
302 | for obj in [f, SimpleClass().method, any, str.upper]: |
General Comments 0
You need to be logged in to leave comments.
Login now