imas_validator.rules.ast_rewrite.rewrite_assert

imas_validator.rules.ast_rewrite.rewrite_assert(old_code: str, filename: str) code

Rewrite block of code to swap assert statement with given assert function

Parameters:
old_code: str

Block of code, most of the time entire file

filename: str

Should give the file from which the code was read; pass some recognizable value if it was not read from a file ('<string>' is commonly used).

Returns:

Rewritten block of code


Last update: 2025-08-29