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

Method test_no_source_file

Lib/test/test_trace.py:575–590  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

573 self.filemod = my_file_and_modname()
574
575 def test_no_source_file(self):
576 filename = "<unknown>"
577 co = traced_func_linear.__code__
578 co = co.replace(co_filename=filename)
579 f = FunctionType(co, globals())
580
581 with captured_stdout() as out:
582 self.tracer.runfunc(f, 2, 3)
583
584 out = out.getvalue().splitlines()
585 firstlineno = get_firstlineno(f)
586 self.assertIn(f" --- modulename: {self.filemod[1]}, funcname: {f.__code__.co_name}", out[0])
587 self.assertIn(f"{filename}({firstlineno + 1})", out[1])
588 self.assertIn(f"{filename}({firstlineno + 2})", out[2])
589 self.assertIn(f"{filename}({firstlineno + 3})", out[3])
590 self.assertIn(f"{filename}({firstlineno + 4})", out[4])
591
592
593if __name__ == '__main__':

Callers

nothing calls this directly

Calls 7

captured_stdoutFunction · 0.90
get_firstlinenoFunction · 0.85
runfuncMethod · 0.80
assertInMethod · 0.80
replaceMethod · 0.45
splitlinesMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected