blob: ec2f10b1d1964e73034172836f7a81ac265254ec (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)
|