MCPcopy Create free account
hub / github.com/pytest-dev/pytest / rewrite_asserts

Function rewrite_asserts

src/_pytest/assertion/rewrite.py:419–426  ·  view source on GitHub ↗

Rewrite the assert statements in mod.

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

Source from the content-addressed store, hash-verified

417
418
419def rewrite_asserts(
420 mod: ast.Module,
421 source: bytes,
422 module_path: Optional[str] = None,
423 config: Optional[Config] = None,
424) -> None:
425 """Rewrite the assert statements in mod."""
426 AssertionRewriter(module_path, config, source).run(mod)
427
428
429def _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