Show More
@@ -14,8 +14,6 b' import tempfile' | |||||
14 | import unittest |
|
14 | import unittest | |
15 | from os.path import join |
|
15 | from os.path import join | |
16 |
|
16 | |||
17 | import nose.tools as nt |
|
|||
18 |
|
||||
19 | from IPython.core.completerlib import magic_run_completer, module_completion, try_import |
|
17 | from IPython.core.completerlib import magic_run_completer, module_completion, try_import | |
20 | from IPython.utils.tempdir import TemporaryDirectory |
|
18 | from IPython.utils.tempdir import TemporaryDirectory | |
21 | from IPython.testing.decorators import onlyif_unicode_paths |
|
19 | from IPython.testing.decorators import onlyif_unicode_paths | |
@@ -140,7 +138,7 b' def test_import_invalid_module():' | |||||
140 |
|
138 | |||
141 | s = set( module_completion('import foo') ) |
|
139 | s = set( module_completion('import foo') ) | |
142 | intersection = s.intersection(invalid_module_names) |
|
140 | intersection = s.intersection(invalid_module_names) | |
143 |
|
|
141 | assert intersection == set() | |
144 |
|
142 | |||
145 | assert valid_module_names.issubset(s), valid_module_names.intersection(s) |
|
143 | assert valid_module_names.issubset(s), valid_module_names.intersection(s) | |
146 |
|
144 | |||
@@ -153,15 +151,15 b' def test_bad_module_all():' | |||||
153 | testsdir = os.path.dirname(__file__) |
|
151 | testsdir = os.path.dirname(__file__) | |
154 | sys.path.insert(0, testsdir) |
|
152 | sys.path.insert(0, testsdir) | |
155 | try: |
|
153 | try: | |
156 |
results = module_completion( |
|
154 | results = module_completion("from bad_all import ") | |
157 |
|
|
155 | assert "puppies" in results | |
158 | for r in results: |
|
156 | for r in results: | |
159 |
|
|
157 | assert isinstance(r, str) | |
160 |
|
158 | |||
161 | # bad_all doesn't contain submodules, but this completion |
|
159 | # bad_all doesn't contain submodules, but this completion | |
162 | # should finish without raising an exception: |
|
160 | # should finish without raising an exception: | |
163 | results = module_completion("import bad_all.") |
|
161 | results = module_completion("import bad_all.") | |
164 |
|
|
162 | assert results == [] | |
165 | finally: |
|
163 | finally: | |
166 | sys.path.remove(testsdir) |
|
164 | sys.path.remove(testsdir) | |
167 |
|
165 | |||
@@ -189,6 +187,6 b' def test_valid_exported_submodules():' | |||||
189 | """ |
|
187 | """ | |
190 | results = module_completion("import os.pa") |
|
188 | results = module_completion("import os.pa") | |
191 | # ensure we get a valid submodule: |
|
189 | # ensure we get a valid submodule: | |
192 |
|
|
190 | assert "os.path" in results | |
193 | # ensure we don't get objects that aren't submodules: |
|
191 | # ensure we don't get objects that aren't submodules: | |
194 |
|
|
192 | assert "os.pathconf" not in results |
General Comments 0
You need to be logged in to leave comments.
Login now