test json.dumps for object with __html__ method
This commit is contained in:
parent
a0e2aca770
commit
6def8a4a48
1 changed files with 10 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import pytest
|
|||
from werkzeug.http import http_date
|
||||
|
||||
import flask
|
||||
from flask import json
|
||||
|
||||
|
||||
@pytest.mark.parametrize("debug", (True, False))
|
||||
|
|
@ -400,3 +401,12 @@ def test_json_key_sorting(app, client):
|
|||
assert lines == sorted_by_int
|
||||
except AssertionError:
|
||||
assert lines == sorted_by_str
|
||||
|
||||
|
||||
def test_html_method():
|
||||
class ObjectWithHTML:
|
||||
def __html__(self):
|
||||
return "<p>test</p>"
|
||||
|
||||
result = json.dumps(ObjectWithHTML())
|
||||
assert result == '"<p>test</p>"'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue