Home / File/ test_tutorial001.py — fastapi Source File

test_tutorial001.py — fastapi Source File

Architecture documentation for test_tutorial001.py, a python file in the fastapi codebase. 4 imports, 0 dependents.

File python FastAPI Applications 4 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  44a255fb_3ebc_1c66_8ab5_bc7681717e52["test_tutorial001.py"]
  5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"]
  44a255fb_3ebc_1c66_8ab5_bc7681717e52 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  44a255fb_3ebc_1c66_8ab5_bc7681717e52 --> a7c04dee_ee23_5891_b185_47ff6bed036d
  75b7515c_c403_b332_0929_cfe34deb0c70["websockets.py"]
  44a255fb_3ebc_1c66_8ab5_bc7681717e52 --> 75b7515c_c403_b332_0929_cfe34deb0c70
  aef3057b_c87f_9bf7_6db4_8eb722c1c9ce["tutorial001_py39.py"]
  44a255fb_3ebc_1c66_8ab5_bc7681717e52 --> aef3057b_c87f_9bf7_6db4_8eb722c1c9ce
  style 44a255fb_3ebc_1c66_8ab5_bc7681717e52 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import pytest
from fastapi.testclient import TestClient
from fastapi.websockets import WebSocketDisconnect

from docs_src.websockets.tutorial001_py39 import app

client = TestClient(app)


def test_main():
    response = client.get("/")
    assert response.status_code == 200, response.text
    assert b"<!DOCTYPE html>" in response.content


def test_websocket():
    with pytest.raises(WebSocketDisconnect):
        with client.websocket_connect("/ws") as websocket:
            message = "Message one"
            websocket.send_text(message)
            data = websocket.receive_text()
            assert data == f"Message text was: {message}"
            message = "Message two"
            websocket.send_text(message)
            data = websocket.receive_text()
            assert data == f"Message text was: {message}"

Domain

Subdomains

Frequently Asked Questions

What does test_tutorial001.py do?
test_tutorial001.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Applications subdomain.
What functions are defined in test_tutorial001.py?
test_tutorial001.py defines 2 function(s): test_main, test_websocket.
What does test_tutorial001.py depend on?
test_tutorial001.py imports 4 module(s): pytest, testclient.py, tutorial001_py39.py, websockets.py.
Where is test_tutorial001.py in the architecture?
test_tutorial001.py is located at tests/test_tutorial/test_websockets/test_tutorial001.py (domain: FastAPI, subdomain: Applications, directory: tests/test_tutorial/test_websockets).

Analyze Your Own Codebase

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

Try Supermodel Free