Home / Function/ test_streaming_with_context_and_custom_close() — flask Function Reference

test_streaming_with_context_and_custom_close() — flask Function Reference

Architecture documentation for the test_streaming_with_context_and_custom_close() function in test_helpers.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  ab1fcaf7_105a_6929_1302_ada274415208["test_streaming_with_context_and_custom_close()"]
  76c30621_3053_d7e5_0aa1_daf0facdcd3e["TestStreaming"]
  ab1fcaf7_105a_6929_1302_ada274415208 -->|defined in| 76c30621_3053_d7e5_0aa1_daf0facdcd3e
  aeed6e85_d75e_4caa_702e_8017da7792a4["close()"]
  ab1fcaf7_105a_6929_1302_ada274415208 -->|calls| aeed6e85_d75e_4caa_702e_8017da7792a4
  729b2b4d_9ff1_7f6f_84a8_82111621cd27["get()"]
  ab1fcaf7_105a_6929_1302_ada274415208 -->|calls| 729b2b4d_9ff1_7f6f_84a8_82111621cd27
  style ab1fcaf7_105a_6929_1302_ada274415208 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_helpers.py lines 264–293

    def test_streaming_with_context_and_custom_close(self, app, client):
        called = []

        class Wrapper:
            def __init__(self, gen):
                self._gen = gen

            def __iter__(self):
                return self

            def close(self):
                called.append(42)

            def __next__(self):
                return next(self._gen)

            next = __next__

        @app.route("/")
        def index():
            def generate():
                yield "Hello "
                yield flask.request.args["name"]
                yield "!"

            return flask.Response(flask.stream_with_context(Wrapper(generate())))

        rv = client.get("/?name=World")
        assert rv.data == b"Hello World!"
        assert called == [42]

Subdomains

Calls

Frequently Asked Questions

What does test_streaming_with_context_and_custom_close() do?
test_streaming_with_context_and_custom_close() is a function in the flask codebase, defined in tests/test_helpers.py.
Where is test_streaming_with_context_and_custom_close() defined?
test_streaming_with_context_and_custom_close() is defined in tests/test_helpers.py at line 264.
What does test_streaming_with_context_and_custom_close() call?
test_streaming_with_context_and_custom_close() calls 2 function(s): close, get.

Analyze Your Own Codebase

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

Try Supermodel Free