Testing of issue https://github.com/ipython/ipython/issues/1107
()
| 129 | # module_completer: |
| 130 | |
| 131 | def test_import_invalid_module(): |
| 132 | """Testing of issue https://github.com/ipython/ipython/issues/1107""" |
| 133 | invalid_module_names = {'foo-bar', 'foo:bar', '10foo'} |
| 134 | valid_module_names = {'foobar'} |
| 135 | with TemporaryDirectory() as tmpdir: |
| 136 | sys.path.insert( 0, tmpdir ) |
| 137 | for name in invalid_module_names | valid_module_names: |
| 138 | filename = os.path.join(tmpdir, name + '.py') |
| 139 | open(filename, 'w').close() |
| 140 | |
| 141 | s = set( module_completion('import foo') ) |
| 142 | intersection = s.intersection(invalid_module_names) |
| 143 | nt.assert_equal(intersection, set()) |
| 144 | |
| 145 | assert valid_module_names.issubset(s), valid_module_names.intersection(s) |
| 146 | |
| 147 | |
| 148 | def test_bad_module_all(): |
nothing calls this directly
no test coverage detected