MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_7

Method test_7

Lib/test/test_pkg.py:239–281  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

237 self.run_code(s)
238
239 def test_7(self):
240 hier = [
241 ("t7.py", ""),
242 ("t7", None),
243 ("t7 __init__.py", ""),
244 ("t7 sub.py",
245 "raise RuntimeError('Shouldnt load sub.py')"),
246 ("t7 sub", None),
247 ("t7 sub __init__.py", ""),
248 ("t7 sub .py",
249 "raise RuntimeError('Shouldnt load subsub.py')"),
250 ("t7 sub subsub", None),
251 ("t7 sub subsub __init__.py",
252 "spam = 1"),
253 ]
254 self.mkhier(hier)
255
256
257 t7, sub, subsub = None, None, None
258 import t7 as tas
259 self.assertEqual(fixdir(dir(tas)),
260 ['__cached__', '__doc__', '__file__', '__loader__',
261 '__name__', '__package__', '__path__', '__spec__'])
262 self.assertFalse(t7)
263 from t7 import sub as subpar
264 self.assertEqual(fixdir(dir(subpar)),
265 ['__cached__', '__doc__', '__file__', '__loader__',
266 '__name__', '__package__', '__path__', '__spec__'])
267 self.assertFalse(t7)
268 self.assertFalse(sub)
269 from t7.sub import subsub as subsubsub
270 self.assertEqual(fixdir(dir(subsubsub)),
271 ['__cached__', '__doc__', '__file__', '__loader__',
272 '__name__', '__package__', '__path__', '__spec__',
273 'spam'])
274 self.assertFalse(t7)
275 self.assertFalse(sub)
276 self.assertFalse(subsub)
277 from t7.sub.subsub import spam as ham
278 self.assertEqual(ham, 1)
279 self.assertFalse(t7)
280 self.assertFalse(sub)
281 self.assertFalse(subsub)
282
283 @unittest.skipIf(sys.flags.optimize >= 2,
284 "Docstrings are omitted with -O2 and above")

Callers

nothing calls this directly

Calls 5

mkhierMethod · 0.95
fixdirFunction · 0.85
dirFunction · 0.85
assertFalseMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected