Ross Jones -
r6148:14eb9904
Not Reviewed
Show More
Add another comment
TODOs: 0 unresolved 0 Resolved
COMMENTS: 0 General 0 Inline
@@ -18,8 +18,9 from os.path import join
18 import nose.tools as nt
18 import nose.tools as nt
19 from nose import SkipTest
19 from nose import SkipTest
20
20
21 from IPython.core.completerlib import magic_run_completer
21 from IPython.core.completerlib import magic_run_completer, module_completion
22 from IPython.utils import py3compat
22 from IPython.utils import py3compat
23 from IPython.utils.tempdir import TemporaryDirectory
23
24
24
25
25 class MockEvent(object):
26 class MockEvent(object):
@@ -65,3 +66,14 class Test_magic_run_completer(unittest.TestCase):
65 match = set(magic_run_completer(mockself, event))
66 match = set(magic_run_completer(mockself, event))
66 self.assertEqual(match, set([u"a.py", u"aaø.py"]))
67 self.assertEqual(match, set([u"a.py", u"aaø.py"]))
67
68
69 def test_import_invalid_module(self):
70 """Testing of issue https://github.com/ipython/ipython/issues/1107"""
71 invalid_module_names = set(['foo-bar', 'foo:bar', '10foo'])
72 with TemporaryDirectory() as tmpdir:
73 sys.path.insert( 0, tmpdir )
74 for name in invalid_module_names:
75 filename = os.path.join(tmpdir, name + '.py')
76 open(filename, 'w').close()
77
78 s = set( module_completion('import foo') )
79 self.assertFalse( s.intersection(invalid_module_names) )
Comments 0
You need to be logged in to leave comments. Login now