forked from orbit-oss/flask
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
|
from werkzeug.http import http_date
|
||||||
|
|
||||||
import flask
|
import flask
|
||||||
|
from flask import json
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("debug", (True, False))
|
@pytest.mark.parametrize("debug", (True, False))
|
||||||
|
|
@ -400,3 +401,12 @@ def test_json_key_sorting(app, client):
|
||||||
assert lines == sorted_by_int
|
assert lines == sorted_by_int
|
||||||
except AssertionError:
|
except AssertionError:
|
||||||
assert lines == sorted_by_str
|
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