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

Function rewrite_asserts

src/_pytest/assertion/rewrite.py:403–410  ·  view source on GitHub ↗

Rewrite the assert statements in mod.

(
    mod: ast.Module,
    source: bytes,
    module_path: str | None = None,
    config: Config | None = None,
)

Source from the content-addressed store, hash-verified

401
402
403def rewrite_asserts(
404 mod: ast.Module,
405 source: bytes,
406 module_path: str | None = None,
407 config: Config | None = None,
408) -> None:
409 """Rewrite the assert statements in mod."""
410 AssertionRewriter(module_path, config, source).run(mod)
411
412
413def _saferepr(obj: object) -> str:

Callers 2

rewriteFunction · 0.90
_rewrite_testFunction · 0.85

Calls 2

AssertionRewriterClass · 0.85
runMethod · 0.45

Tested by 1

rewriteFunction · 0.72