]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
Tests: Adapt expected traceback regexes for Python 3.11.0a1 1527/head
authorMiro Hrončok <miro@hroncok.cz>
Thu, 4 Nov 2021 17:03:06 +0000 (18:03 +0100)
committerDavid Lord <davidism@gmail.com>
Fri, 5 Nov 2021 14:19:04 +0000 (07:19 -0700)
Fixes https://github.com/pallets/jinja/issues/1526

Before:

      File ".../broken.html", line 2, in <module>
        {{ fail() }}
      File ".../test_debug.py", line 32, in <lambda>
        tmpl.render(fail=lambda: 1 / 0)
    ZeroDivisionError: division by zero

After:

      File ".../broken.html", line 2, in <module>
        {{ fail() }}
        ^^^^^^^^^^^^
      File ".../test_debug.py", line 32, in <lambda>
        tmpl.render(fail=lambda: 1 / 0)
                                 ~~^~~
    ZeroDivisionError: division by zero

tests/test_debug.py

index 0aec78ae48f54a8f8c274df20fd7a2a337ea6cc1..1cb931cfc189f5e65eb62e8d3811be25f7b10492 100644 (file)
@@ -36,9 +36,11 @@ class TestDebug:
             test,
             r"""
   File ".*?broken.html", line 2, in (top-level template code|<module>)
-    \{\{ fail\(\) \}\}
+    \{\{ fail\(\) \}\}(
+    \^{12})?
   File ".*debug?.pyc?", line \d+, in <lambda>
-    tmpl\.render\(fail=lambda: 1 / 0\)
+    tmpl\.render\(fail=lambda: 1 / 0\)(
+                             ~~\^~~)?
 ZeroDivisionError: (int(eger)? )?division (or modulo )?by zero
 """,
         )
@@ -66,7 +68,8 @@ to be closed is 'for'.
             test,
             r"""
   File ".*debug.pyc?", line \d+, in test
-    raise TemplateSyntaxError\("wtf", 42\)
+    raise TemplateSyntaxError\("wtf", 42\)(
+    \^{36})?
 (jinja2\.exceptions\.)?TemplateSyntaxError: wtf
   line 42""",
         )