MCPcopy Index your code
hub / github.com/python/cpython / test_invalid_names

Method test_invalid_names

Lib/test/test_runpy.py:205–218  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

203 self.fail("Expected import error for " + mod_name)
204
205 def test_invalid_names(self):
206 # Builtin module
207 self.expect_import_error("sys")
208 # Non-existent modules
209 self.expect_import_error("sys.imp.eric")
210 self.expect_import_error("os.path.half")
211 self.expect_import_error("a.bee")
212 # Relative names not allowed
213 self.expect_import_error(".howard")
214 self.expect_import_error("..eaten")
215 self.expect_import_error(".test_runpy")
216 self.expect_import_error(".unittest")
217 # Package without __main__.py
218 self.expect_import_error("multiprocessing")
219
220 def test_library_module(self):
221 self.assertEqual(run_module("runpy")["__name__"], "runpy")

Callers

nothing calls this directly

Calls 1

expect_import_errorMethod · 0.95

Tested by

no test coverage detected