]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
Tests: Make "Traceback did not match" an actual f-string 1525/head
authorMiro Hrončok <miro@hroncok.cz>
Tue, 2 Nov 2021 15:47:28 +0000 (16:47 +0100)
committerGitHub <noreply@github.com>
Tue, 2 Nov 2021 15:47:28 +0000 (16:47 +0100)
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

tests/test_debug.py

index 0aec78ae48f54a8f8c274df20fd7a2a337ea6cc1..c639bbc2921737a59bdfe8ded6f6a6842e9b1151 100644 (file)
@@ -25,7 +25,7 @@ class TestDebug:
         m = re.search(expected_tb.strip(), "".join(tb))
         assert (
             m is not None
-        ), "Traceback did not match:\n\n{''.join(tb)}\nexpected:\n{expected_tb}"
+        ), f"Traceback did not match:\n\n{''.join(tb)}\nexpected:\n{expected_tb}"
 
     def test_runtime_error(self, fs_env):
         def test():