pallets / jinja

A very fast and expressive template engine.
https://jinja.palletsprojects.com
BSD 3-Clause "New" or "Revised" License
10.23k stars 1.6k forks source link

test_striptags regressed with markupsafe 2.1.4 #1930

Closed mweinelt closed 7 months ago

mweinelt commented 7 months ago

After upgrading markupsafe to 2.1.4 in nixpkgs, we are seeing test_striptags fail. The comparison string seems to have gained a trailing space.

https://github.com/pallets/markupsafe/issues/417

__________________________ TestFilter.test_striptags ___________________________

self = <test_filters.TestFilter object at 0x7ffff5795cd0>
env = <jinja2.environment.Environment object at 0x7ffff597a0d0>

    def test_striptags(self, env):
        tmpl = env.from_string("""{{ foo|striptags }}""")
        out = tmpl.render(
            foo='  <p>just a small   \n <a href="#">'
            "example</a> link</p>\n<p>to a webpage</p> "
            "<!-- <p>and some commented stuff</p> -->"
        )
>       assert out == "just a small example link to a webpage"
E       AssertionError: assert 'just a small...to a webpage ' == 'just a small... to a webpage'
E         - just a small example link to a webpage
E         + just a small example link to a webpage 
E         ?                                       +

tests/test_filters.py:101: AssertionError

Expectations

The issue seems to be in markupsafe, so maybe you want to exclude that version.

Reproducer

Environment:

davidism commented 7 months ago

Already reported to MarkupSafe https://github.com/pallets/markupsafe/issues/417