diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:10:54 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:10:54 +0000 |
commit | 3b2c8da6b3117ca186e27a7f94fa44b17f6a82ed (patch) | |
tree | d8d343b76ef070019c69531e4bd0f0964804e4d4 /tests/test_exception_custom_html.py | |
parent | Initial commit. (diff) | |
download | markupsafe-3b2c8da6b3117ca186e27a7f94fa44b17f6a82ed.tar.xz markupsafe-3b2c8da6b3117ca186e27a7f94fa44b17f6a82ed.zip |
Adding upstream version 2.1.2.upstream/2.1.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_exception_custom_html.py')
-rw-r--r-- | tests/test_exception_custom_html.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_exception_custom_html.py b/tests/test_exception_custom_html.py new file mode 100644 index 0000000..ec2f10b --- /dev/null +++ b/tests/test_exception_custom_html.py @@ -0,0 +1,18 @@ +import pytest + + +class CustomHtmlThatRaises: + def __html__(self): + raise ValueError(123) + + +def test_exception_custom_html(escape): + """Checks whether exceptions in custom __html__ implementations are + propagated correctly. + + There was a bug in the native implementation at some point: + https://github.com/pallets/markupsafe/issues/108 + """ + obj = CustomHtmlThatRaises() + with pytest.raises(ValueError): + escape(obj) |