1import pytest 2 3 4class CustomHtmlThatRaises: 5 def __html__(self): 6 raise ValueError(123) 7 8 9def test_exception_custom_html(escape): 10 """Checks whether exceptions in custom __html__ implementations are 11 propagated correctly. 12 13 There was a bug in the native implementation at some point: 14 https://github.com/pallets/markupsafe/issues/108 15 """ 16 obj = CustomHtmlThatRaises() 17 with pytest.raises(ValueError): 18 escape(obj) 19