Home / Function/ test_custom_tag() — flask Function Reference

test_custom_tag() — flask Function Reference

Architecture documentation for the test_custom_tag() function in test_json_tag.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  f091763f_06f5_db16_4c12_7c3e194dc0df["test_custom_tag()"]
  9ee4537d_ef85_ee15_7a39_4a9f1c7ee7e2["test_json_tag.py"]
  f091763f_06f5_db16_4c12_7c3e194dc0df -->|defined in| 9ee4537d_ef85_ee15_7a39_4a9f1c7ee7e2
  f2bd2818_0e0d_8d29_c64f_d3fe1b3d615c["check()"]
  f091763f_06f5_db16_4c12_7c3e194dc0df -->|calls| f2bd2818_0e0d_8d29_c64f_d3fe1b3d615c
  59a52de5_5f8b_b81e_7e81_7c03817b69cb["to_json()"]
  f091763f_06f5_db16_4c12_7c3e194dc0df -->|calls| 59a52de5_5f8b_b81e_7e81_7c03817b69cb
  2e075fbc_ca53_a705_9db0_e97c109fee33["to_python()"]
  f091763f_06f5_db16_4c12_7c3e194dc0df -->|calls| 2e075fbc_ca53_a705_9db0_e97c109fee33
  style f091763f_06f5_db16_4c12_7c3e194dc0df fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_json_tag.py lines 43–63

def test_custom_tag():
    class Foo:  # noqa: B903, for Python2 compatibility
        def __init__(self, data):
            self.data = data

    class TagFoo(JSONTag):
        __slots__ = ()
        key = " f"

        def check(self, value):
            return isinstance(value, Foo)

        def to_json(self, value):
            return self.serializer.tag(value.data)

        def to_python(self, value):
            return Foo(value)

    s = TaggedJSONSerializer()
    s.register(TagFoo)
    assert s.loads(s.dumps(Foo("bar"))).data == "bar"

Subdomains

Frequently Asked Questions

What does test_custom_tag() do?
test_custom_tag() is a function in the flask codebase, defined in tests/test_json_tag.py.
Where is test_custom_tag() defined?
test_custom_tag() is defined in tests/test_json_tag.py at line 43.
What does test_custom_tag() call?
test_custom_tag() calls 3 function(s): check, to_json, to_python.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free