Show More
@@ -392,6 +392,10 b' class Completer(Configurable):' | |||||
392 | words = generics.complete_object(obj, words) |
|
392 | words = generics.complete_object(obj, words) | |
393 | except TryNext: |
|
393 | except TryNext: | |
394 | pass |
|
394 | pass | |
|
395 | except Exception: | |||
|
396 | # Silence errors from completion function | |||
|
397 | #raise # dbg | |||
|
398 | pass | |||
395 | # Build match list to return |
|
399 | # Build match list to return | |
396 | n = len(attr) |
|
400 | n = len(attr) | |
397 | res = ["%s.%s" % (expr, w) for w in words if w[:n] == attr ] |
|
401 | res = ["%s.%s" % (expr, w) for w in words if w[:n] == attr ] |
@@ -16,6 +16,7 b' import nose.tools as nt' | |||||
16 | from IPython.core import completer |
|
16 | from IPython.core import completer | |
17 | from IPython.external.decorators import knownfailureif |
|
17 | from IPython.external.decorators import knownfailureif | |
18 | from IPython.utils.tempdir import TemporaryDirectory |
|
18 | from IPython.utils.tempdir import TemporaryDirectory | |
|
19 | from IPython.utils.generics import complete_object | |||
19 |
|
20 | |||
20 | #----------------------------------------------------------------------------- |
|
21 | #----------------------------------------------------------------------------- | |
21 | # Test functions |
|
22 | # Test functions | |
@@ -83,6 +84,18 b' def test_line_split():' | |||||
83 | # all inputs turned into unicode |
|
84 | # all inputs turned into unicode | |
84 | check_line_split(sp, [ map(unicode, p) for p in t] ) |
|
85 | check_line_split(sp, [ map(unicode, p) for p in t] ) | |
85 |
|
86 | |||
|
87 | def test_custom_completion_error(): | |||
|
88 | """Test that errors from custom attribute completers are silenced.""" | |||
|
89 | ip = get_ipython() | |||
|
90 | class A(object): pass | |||
|
91 | ip.user_ns['a'] = A() | |||
|
92 | ||||
|
93 | @complete_object.when_type(A) | |||
|
94 | def complete_A(a, existing_completions): | |||
|
95 | raise TypeError("this should be silenced") | |||
|
96 | ||||
|
97 | ip.complete("a.") | |||
|
98 | ||||
86 |
|
99 | |||
87 | def test_unicode_completions(): |
|
100 | def test_unicode_completions(): | |
88 | ip = get_ipython() |
|
101 | ip = get_ipython() |
General Comments 0
You need to be logged in to leave comments.
Login now