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