MCPcopy
hub / github.com/pytest-dev/pytest / test_repr_source

Method test_repr_source

testing/code/test_excinfo.py:604–616  ·  testing/code/test_excinfo.py::TestExceptionInfoFormatter.test_repr_source
(self)

Source from the content-addressed store, hash-verified

602 return importasmod
603
604 def test_repr_source(self):
605 pr = ExceptionInfoFormatter()
606 source = _pytest._code.Source(
607 class="st">"""\
608 def f(x):
609 pass
610 class="st">"""
611 ).strip()
612 pr.flow_marker = class="st">"|" class="cm"># type: ignore[misc]
613 lines = pr.get_source(source, 0)
614 assert len(lines) == 2
615 assert lines[0] == class="st">"| def f(x):"
616 assert lines[1] == class="st">" pass"
617
618 def test_repr_source_out_of_bounds(self):
619 pr = ExceptionInfoFormatter()

Callers

nothing calls this directly

Calls 3

get_sourceMethod · 0.95
stripMethod · 0.80

Tested by

no test coverage detected