Skip to content
Myr

Tests: Make "Traceback did not match" an actual f-string

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Otherwise the failure looks like this: > assert ( m is not None ), "Traceback did not match:\n\n{''.join(tb)}\nexpected:\n{expected_tb}" E AssertionError: Traceback did not match: E E {''.join(tb)} E expected: E {expected_tb} E assert None is not None

authored by Miro Hrončok · committed by GitHub · parent 15f02c4 · Browse files · 1 file+1 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−1 removed

  • tests:+1 added−1 removed

1 file+1 added−1 removed

modified:tests/test_debug.py+1 added-1 removed
23 unmodified lines
24 tb = format_exception(exc_info.type, exc_info.value, exc_info.tb)25 m = re.search(expected_tb.strip(), "".join(tb))26 assert (27 m is not None28 ), "Traceback did not match:\n\n{''.join(tb)}\nexpected:\n{expected_tb}"28 ), f"Traceback did not match:\n\n{''.join(tb)}\nexpected:\n{expected_tb}"2930 def test_runtime_error(self, fs_env):31 def test():32 tmpl.render(fail=lambda: 1 / 0)
82 unmodified lines