Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 202 for rick (0.04 sec)

  1. tests/test_route_scope.py

    
    client = TestClient(app)
    
    
    def test_get():
        response = client.get("/users/rick")
        assert response.status_code == 200, response.text
        assert response.json() == {"user_id": "rick", "path": "/users/{user_id}"}
    
    
    def test_invalid_method_doesnt_match():
        response = client.post("/users/rick")
        assert response.status_code == 405, response.text
    
    
    def test_invalid_path_doesnt_match():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Sep 29 03:29:38 UTC 2025
    - 1.5K bytes
    - Viewed (0)
  2. tests/test_dependency_yield_except_httpexception.py

        assert state["finally"] is False
        response = client.put("/invalid-user/rick", json="Morty")
        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "Invalid user"}
        assert state["except"] is True
        assert state["finally"] is True
        assert fake_database["rick"] == "Rick Sanchez"
    
    
    def test_dependency_no_exception():
        assert state["except"] is False
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Sep 29 03:29:38 UTC 2025
    - 1.9K bytes
    - Viewed (0)
  3. tests/test_forms_single_model.py

            "/form/",
            data={
                "username": "Rick",
                "lastname": "Sanchez",
                "age": "70",
                "tags": ["plumbus", "citadel"],
                "with": "something",
            },
        )
        assert response.status_code == 200, response.text
        assert response.json() == {
            "username": "Rick",
            "lastname": "Sanchez",
            "age": 70,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 3.4K bytes
    - Viewed (0)
  4. tests/test_forms_single_param.py

        return username
    
    
    client = TestClient(app)
    
    
    def test_single_form_field():
        response = client.post("/form/", data={"username": "Rick"})
        assert response.status_code == 200, response.text
        assert response.json() == "Rick"
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 3.5K bytes
    - Viewed (0)
  5. docs_src/path_params/tutorial003b_py39.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/users")
    async def read_users():
        return ["Rick", "Morty"]
    
    
    @app.get("/users")
    async def read_users2():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 193 bytes
    - Viewed (0)
  6. docs_src/dependencies/tutorial008b_py39.py

    
    data = {
        "plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"},
        "portal-gun": {"description": "Gun to create portals", "owner": "Rick"},
    }
    
    
    class OwnerError(Exception):
        pass
    
    
    def get_username():
        try:
            yield "Rick"
        except OwnerError as e:
            raise HTTPException(status_code=400, detail=f"Owner error: {e}")
    
    
    @app.get("/items/{item_id}")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 735 bytes
    - Viewed (0)
  7. docs_src/dependencies/tutorial012_py39.py

    
    @app.get("/items/")
    async def read_items():
        return [{"item": "Portal Gun"}, {"item": "Plumbus"}]
    
    
    @app.get("/users/")
    async def read_users():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 696 bytes
    - Viewed (0)
  8. tests/test_tutorial/test_path_params/test_tutorial003b.py

    client = TestClient(app)
    
    
    def test_get_users():
        response = client.get("/users")
        assert response.status_code == 200, response.text
        assert response.json() == ["Rick", "Morty"]
    
    
    def test_read_users2():  # Just for coverage
        assert asyncio.run(read_users2()) == ["Bean", "Elfo"]
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.3K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_dependencies/test_tutorial008b.py

        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "Owner error: Rick"}
    
    
    def test_get_item(client: TestClient):
        response = client.get("/items/portal-gun")
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1K bytes
    - Viewed (0)
  10. docs_src/dependencies/tutorial008c_an_py39.py

    from typing import Annotated
    
    from fastapi import Depends, FastAPI, HTTPException
    
    app = FastAPI()
    
    
    class InternalError(Exception):
        pass
    
    
    def get_username():
        try:
            yield "Rick"
        except InternalError:
            print("Oops, we didn't raise again, Britney 😱")
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
        if item_id == "portal-gun":
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Feb 24 23:06:37 UTC 2024
    - 700 bytes
    - Viewed (0)
Back to top