Home / Function/ test_custom_converters() — flask Function Reference

test_custom_converters() — flask Function Reference

Architecture documentation for the test_custom_converters() function in test_converters.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  b44bf44b_a52e_5118_3f21_286ad66fab86["test_custom_converters()"]
  61c5aef3_6155_356d_2c43_c6f91ebc8dd9["test_converters.py"]
  b44bf44b_a52e_5118_3f21_286ad66fab86 -->|defined in| 61c5aef3_6155_356d_2c43_c6f91ebc8dd9
  d3c3c2bd_54af_9673_e3b3_efe69aa39ba2["to_url()"]
  b44bf44b_a52e_5118_3f21_286ad66fab86 -->|calls| d3c3c2bd_54af_9673_e3b3_efe69aa39ba2
  799eacb8_3bfa_1cbc_77f3_40ba145cde48["to_python()"]
  b44bf44b_a52e_5118_3f21_286ad66fab86 -->|calls| 799eacb8_3bfa_1cbc_77f3_40ba145cde48
  style b44bf44b_a52e_5118_3f21_286ad66fab86 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_converters.py lines 8–26

def test_custom_converters(app, client):
    class ListConverter(BaseConverter):
        def to_python(self, value):
            return value.split(",")

        def to_url(self, value):
            base_to_url = super().to_url
            return ",".join(base_to_url(x) for x in value)

    app.url_map.converters["list"] = ListConverter

    @app.route("/<list:args>")
    def index(args):
        return "|".join(args)

    assert client.get("/1,2,3").data == b"1|2|3"

    with app.test_request_context():
        assert url_for("index", args=[4, 5, 6]) == "/4,5,6"

Subdomains

Frequently Asked Questions

What does test_custom_converters() do?
test_custom_converters() is a function in the flask codebase, defined in tests/test_converters.py.
Where is test_custom_converters() defined?
test_custom_converters() is defined in tests/test_converters.py at line 8.
What does test_custom_converters() call?
test_custom_converters() calls 2 function(s): to_python, to_url.

Analyze Your Own Codebase

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

Try Supermodel Free