test_json.py — flask Source File
Architecture documentation for test_json.py, a python file in the flask codebase. 9 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR f9bd76f2_7704_622d_4d31_ee892fa7fced["test_json.py"] bdb4799f_8b0c_fcfd_51cc_f0b833652f8f["datetime"] f9bd76f2_7704_622d_4d31_ee892fa7fced --> bdb4799f_8b0c_fcfd_51cc_f0b833652f8f 148a8303_4748_e3d5_e14d_4289067aa7d6["decimal"] f9bd76f2_7704_622d_4d31_ee892fa7fced --> 148a8303_4748_e3d5_e14d_4289067aa7d6 ae09b50b_b5d6_a85f_ee35_4bca99dcf5dd["io"] f9bd76f2_7704_622d_4d31_ee892fa7fced --> ae09b50b_b5d6_a85f_ee35_4bca99dcf5dd c26d67c5_e5bf_05b7_bcb4_ac69089e1109["uuid"] f9bd76f2_7704_622d_4d31_ee892fa7fced --> c26d67c5_e5bf_05b7_bcb4_ac69089e1109 da94d511_b8b8_a450_f67f_fc28ea9b648a["pytest"] f9bd76f2_7704_622d_4d31_ee892fa7fced --> da94d511_b8b8_a450_f67f_fc28ea9b648a c8ef0481_732f_584a_537b_20ea831e8fd0["werkzeug.http"] f9bd76f2_7704_622d_4d31_ee892fa7fced --> c8ef0481_732f_584a_537b_20ea831e8fd0 8c762fc5_c0b6_0d4d_3889_896d80fbf225["flask"] f9bd76f2_7704_622d_4d31_ee892fa7fced --> 8c762fc5_c0b6_0d4d_3889_896d80fbf225 e049dc16_809c_4f9a_d147_92b4f6d4a7d8["flask.json.provider"] f9bd76f2_7704_622d_4d31_ee892fa7fced --> e049dc16_809c_4f9a_d147_92b4f6d4a7d8 04fa2832_36af_5854_5fc1_8cf61c26d3bb["codecs"] f9bd76f2_7704_622d_4d31_ee892fa7fced --> 04fa2832_36af_5854_5fc1_8cf61c26d3bb style f9bd76f2_7704_622d_4d31_ee892fa7fced fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import datetime
import decimal
import io
import uuid
import pytest
from werkzeug.http import http_date
import flask
from flask import json
from flask.json.provider import DefaultJSONProvider
@pytest.mark.parametrize("debug", (True, False))
def test_bad_request_debug_message(app, client, debug):
app.config["DEBUG"] = debug
app.config["TRAP_BAD_REQUEST_ERRORS"] = False
@app.route("/json", methods=["POST"])
def post_json():
flask.request.get_json()
return None
rv = client.post("/json", data=None, content_type="application/json")
assert rv.status_code == 400
contains = b"Failed to decode JSON object" in rv.data
assert contains == debug
def test_json_bad_requests(app, client):
@app.route("/json", methods=["POST"])
def return_json():
return flask.jsonify(foo=str(flask.request.get_json()))
rv = client.post("/json", data="malformed", content_type="application/json")
assert rv.status_code == 400
def test_json_custom_mimetypes(app, client):
@app.route("/json", methods=["POST"])
def return_json():
return flask.request.get_json()
rv = client.post("/json", data='"foo"', content_type="application/x+json")
assert rv.data == b"foo"
@pytest.mark.parametrize(
"test_value,expected", [(True, '"\\u2603"'), (False, '"\u2603"')]
)
def test_json_as_unicode(test_value, expected, app, app_ctx):
app.json.ensure_ascii = test_value
rv = app.json.dumps("\N{SNOWMAN}")
assert rv == expected
def test_json_dump_to_file(app, app_ctx):
test_data = {"name": "Flask"}
out = io.StringIO()
// ... (287 more lines)
Domain
Subdomains
Functions
- _has_encoding()
- test_bad_request_debug_message()
- test_html_method()
- test_json_as_unicode()
- test_json_attr()
- test_json_bad_requests()
- test_json_custom_mimetypes()
- test_json_customization()
- test_json_decimal()
- test_json_dump_to_file()
- test_json_key_sorting()
- test_jsonify_arrays()
- test_jsonify_aware_datetimes()
- test_jsonify_basic_types()
- test_jsonify_datetime()
- test_jsonify_dicts()
- test_jsonify_uuid_types()
- test_tojson_filter()
Dependencies
- codecs
- datetime
- decimal
- flask
- flask.json.provider
- io
- pytest
- uuid
- werkzeug.http
Source
Frequently Asked Questions
What does test_json.py do?
test_json.py is a source file in the flask codebase, written in python. It belongs to the ApplicationCore domain, AppLifeCycle subdomain.
What functions are defined in test_json.py?
test_json.py defines 18 function(s): _has_encoding, test_bad_request_debug_message, test_html_method, test_json_as_unicode, test_json_attr, test_json_bad_requests, test_json_custom_mimetypes, test_json_customization, test_json_decimal, test_json_dump_to_file, and 8 more.
What does test_json.py depend on?
test_json.py imports 9 module(s): codecs, datetime, decimal, flask, flask.json.provider, io, pytest, uuid, and 1 more.
Where is test_json.py in the architecture?
test_json.py is located at tests/test_json.py (domain: ApplicationCore, subdomain: AppLifeCycle, directory: tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free