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

Method test_no_source_file

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

Source from the content-addressed store, hash-verified

583
584 @unittest.expectedFailure # TODO: RUSTPYTHON; IndexError: list index out of range
585 def test_no_source_file(self):
586 filename = "<unknown>"
587 co = traced_func_linear.__code__
588 co = co.replace(co_filename=filename)
589 f = FunctionType(co, globals())
590
591 with captured_stdout() as out:
592 self.tracer.runfunc(f, 2, 3)
593
594 out = out.getvalue().splitlines()
595 firstlineno = get_firstlineno(f)
596 self.assertIn(f" --- modulename: {self.filemod[1]}, funcname: {f.__code__.co_name}", out[0])
597 self.assertIn(f"{filename}({firstlineno + 1})", out[1])
598 self.assertIn(f"{filename}({firstlineno + 2})", out[2])
599 self.assertIn(f"{filename}({firstlineno + 3})", out[3])
600 self.assertIn(f"{filename}({firstlineno + 4})", out[4])
601
602
603if __name__ == '__main__':

Callers

nothing calls this directly

Calls 9

FunctionTypeFunction · 0.90
captured_stdoutFunction · 0.90
globalsFunction · 0.85
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