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