Show More
@@ -85,6 +85,7 b' def test_line_split():' | |||||
85 | # all inputs turned into unicode |
|
85 | # all inputs turned into unicode | |
86 | check_line_split(sp, [ map(unicode, p) for p in t] ) |
|
86 | check_line_split(sp, [ map(unicode, p) for p in t] ) | |
87 |
|
87 | |||
|
88 | ||||
88 | def test_custom_completion_error(): |
|
89 | def test_custom_completion_error(): | |
89 | """Test that errors from custom attribute completers are silenced.""" |
|
90 | """Test that errors from custom attribute completers are silenced.""" | |
90 | ip = get_ipython() |
|
91 | ip = get_ipython() | |
@@ -151,6 +152,7 b' def test_has_open_quotes4():' | |||||
151 | for s in ['""', '""" """', '"hi" "ipython"']: |
|
152 | for s in ['""', '""" """', '"hi" "ipython"']: | |
152 | nt.assert_false(completer.has_open_quotes(s)) |
|
153 | nt.assert_false(completer.has_open_quotes(s)) | |
153 |
|
154 | |||
|
155 | ||||
154 | @knownfailureif(sys.platform == 'win32', "abspath completions fail on Windows") |
|
156 | @knownfailureif(sys.platform == 'win32', "abspath completions fail on Windows") | |
155 | def test_abspath_file_completions(): |
|
157 | def test_abspath_file_completions(): | |
156 | ip = get_ipython() |
|
158 | ip = get_ipython() | |
@@ -171,6 +173,7 b' def test_abspath_file_completions():' | |||||
171 | comp = [prefix+s for s in suffixes] |
|
173 | comp = [prefix+s for s in suffixes] | |
172 | nt.assert_equal(c, comp) |
|
174 | nt.assert_equal(c, comp) | |
173 |
|
175 | |||
|
176 | ||||
174 | def test_local_file_completions(): |
|
177 | def test_local_file_completions(): | |
175 | ip = get_ipython() |
|
178 | ip = get_ipython() | |
176 | cwd = os.getcwdu() |
|
179 | cwd = os.getcwdu() | |
@@ -196,6 +199,7 b' def test_local_file_completions():' | |||||
196 | # prevent failures from making chdir stick |
|
199 | # prevent failures from making chdir stick | |
197 | os.chdir(cwd) |
|
200 | os.chdir(cwd) | |
198 |
|
201 | |||
|
202 | ||||
199 | def test_greedy_completions(): |
|
203 | def test_greedy_completions(): | |
200 | ip = get_ipython() |
|
204 | ip = get_ipython() | |
201 | ip.Completer.greedy = False |
|
205 | ip.Completer.greedy = False | |
@@ -206,6 +210,7 b' def test_greedy_completions():' | |||||
206 | _,c = ip.complete('.',line='a[0].') |
|
210 | _,c = ip.complete('.',line='a[0].') | |
207 | nt.assert_true('a[0].real' in c, "Should have completed on a[0]: %s"%c) |
|
211 | nt.assert_true('a[0].real' in c, "Should have completed on a[0]: %s"%c) | |
208 |
|
212 | |||
|
213 | ||||
209 | def test_omit__names(): |
|
214 | def test_omit__names(): | |
210 | # also happens to test IPCompleter as a configurable |
|
215 | # also happens to test IPCompleter as a configurable | |
211 | ip = get_ipython() |
|
216 | ip = get_ipython() | |
@@ -242,6 +247,7 b' def test_limit_to__all__False_ok():' | |||||
242 | s, matches = c.complete('d.') |
|
247 | s, matches = c.complete('d.') | |
243 | nt.assert_true('d.x' in matches) |
|
248 | nt.assert_true('d.x' in matches) | |
244 |
|
249 | |||
|
250 | ||||
245 | def test_limit_to__all__True_ok(): |
|
251 | def test_limit_to__all__True_ok(): | |
246 | ip = get_ipython() |
|
252 | ip = get_ipython() | |
247 | c = ip.Completer |
|
253 | c = ip.Completer | |
@@ -255,14 +261,26 b' def test_limit_to__all__True_ok():' | |||||
255 | nt.assert_true('d.z' in matches) |
|
261 | nt.assert_true('d.z' in matches) | |
256 | nt.assert_false('d.x' in matches) |
|
262 | nt.assert_false('d.x' in matches) | |
257 |
|
263 | |||
|
264 | ||||
258 | def test_get__all__entries_ok(): |
|
265 | def test_get__all__entries_ok(): | |
259 | class A(object): |
|
266 | class A(object): | |
260 | __all__ = ['x', 1] |
|
267 | __all__ = ['x', 1] | |
261 | words = completer.get__all__entries(A()) |
|
268 | words = completer.get__all__entries(A()) | |
262 | nt.assert_equal(words, ['x']) |
|
269 | nt.assert_equal(words, ['x']) | |
|
270 | ||||
263 |
|
271 | |||
264 | def test_get__all__entries_no__all__ok(): |
|
272 | def test_get__all__entries_no__all__ok(): | |
265 | class A(object): |
|
273 | class A(object): | |
266 | pass |
|
274 | pass | |
267 | words = completer.get__all__entries(A()) |
|
275 | words = completer.get__all__entries(A()) | |
268 | nt.assert_equal(words, []) |
|
276 | nt.assert_equal(words, []) | |
|
277 | ||||
|
278 | ||||
|
279 | def test_func_kw_completions(): | |||
|
280 | ip = get_ipython() | |||
|
281 | c = ip.Completer | |||
|
282 | ip.ex('def myfunc(a=1,b=2): return a+b') | |||
|
283 | s, matches = c.complete(None,'myfunc(1,b') | |||
|
284 | nt.assert_true('b=' in matches) | |||
|
285 | s, matches = c.complete(None,'myfunc(1,b)',10) | |||
|
286 | nt.assert_true('b=' in matches) |
General Comments 0
You need to be logged in to leave comments.
Login now