Show More
@@ -152,7 +152,12 b' def is_importable(module, attr, only_modules):' | |||
|
152 | 152 | else: |
|
153 | 153 | return not(attr[:2] == '__' and attr[-2:] == '__') |
|
154 | 154 | |
|
155 | def try_import(mod, only_modules=False): | |
|
155 | ||
|
156 | def try_import(mod: str, only_modules=False): | |
|
157 | """ | |
|
158 | Try to import given module and return list of potential completions. | |
|
159 | """ | |
|
160 | mod = mod.rstrip('.') | |
|
156 | 161 | try: |
|
157 | 162 | m = import_module(mod) |
|
158 | 163 | except: |
@@ -712,6 +712,14 b' def test_object_key_completion():' | |||
|
712 | 712 | nt.assert_in('qwick', matches) |
|
713 | 713 | |
|
714 | 714 | |
|
715 | def test_tryimport(): | |
|
716 | """ | |
|
717 | Test that try-import don't crash on trailing dot, and import modules before | |
|
718 | """ | |
|
719 | from IPython.core.completerlib import try_import | |
|
720 | assert(try_import("IPython.")) | |
|
721 | ||
|
722 | ||
|
715 | 723 | def test_aimport_module_completer(): |
|
716 | 724 | ip = get_ipython() |
|
717 | 725 | _, matches = ip.complete('i', '%aimport i') |
General Comments 0
You need to be logged in to leave comments.
Login now