Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 70 for parametrizar (0.06 sec)

  1. tests/test_request_params/test_body/test_list.py

                    "type": "array",
                },
            },
            "required": ["p"],
            "title": body_model_name,
            "type": "object",
        }
    
    
    @pytest.mark.parametrize("json", [None, {}])
    @pytest.mark.parametrize(
        "path",
        ["/required-list-str", "/model-required-list-str"],
    )
    def test_required_list_str_missing(path: str, json: Union[dict, None]):
        client = TestClient(app)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:31:34 UTC 2025
    - 11.9K bytes
    - Viewed (0)
  2. tests/test_request_params/test_cookie/test_required_str.py

    class CookieModelRequiredStr(BaseModel):
        p: str
    
    
    @app.get("/model-required-str")
    async def read_model_required_str(p: Annotated[CookieModelRequiredStr, Cookie()]):
        return {"p": p.p}
    
    
    @pytest.mark.parametrize(
        "path",
        ["/required-str", "/model-required-str"],
    )
    def test_required_str_schema(path: str):
        assert app.openapi()["paths"][path]["get"]["parameters"] == [
            {
                "required": True,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 10.2K bytes
    - Viewed (0)
  3. tests/test_request_params/test_file/test_required.py

    
    @app.post("/required-uploadfile", operation_id="required_uploadfile")
    async def read_required_uploadfile(p: Annotated[UploadFile, File()]):
        return {"file_size": p.size}
    
    
    @pytest.mark.parametrize(
        "path",
        [
            "/required-bytes",
            "/required-uploadfile",
        ],
    )
    def test_required_schema(path: str):
        openapi = app.openapi()
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 10.8K bytes
    - Viewed (0)
  4. tests/test_request_params/test_form/test_list.py

    
    @app.post("/model-required-list-str", operation_id="model_required_list_str")
    def read_model_required_list_str(p: Annotated[FormModelRequiredListStr, Form()]):
        return {"p": p.p}
    
    
    @pytest.mark.parametrize(
        "path",
        ["/required-list-str", "/model-required-list-str"],
    )
    def test_required_list_str_schema(path: str):
        openapi = app.openapi()
        body_model_name = get_body_model_name(openapi, path)
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:31:34 UTC 2025
    - 11.7K bytes
    - Viewed (0)
  5. tests/test_request_params/test_body/test_optional_str.py

                },
            ],
        }
    
    
    @pytest.mark.parametrize(
        "path",
        ["/optional-str", "/model-optional-str"],
    )
    def test_optional_str_missing_empty_dict(path: str):
        client = TestClient(app)
        response = client.post(path, json={})
        assert response.status_code == 200, response.text
        assert response.json() == {"p": None}
    
    
    @pytest.mark.parametrize(
        "path",
        ["/optional-str", "/model-optional-str"],
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 11.6K bytes
    - Viewed (0)
  6. tests/test_allow_inf_nan_in_enforcing.py

    
    @pytest.mark.parametrize(
        "value,code",
        [
            ("-1", 200),
            ("inf", 200),
            ("-inf", 200),
            ("nan", 200),
            ("0", 200),
            ("342", 200),
        ],
    )
    def test_allow_inf_nan_param_default(value: str, code: int):
        response = client.post(f"/?z={value}")
        assert response.status_code == code, response.text
    
    
    @pytest.mark.parametrize(
        "value,code",
        [
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 1.8K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_body/test_tutorial002.py

        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.body.{request.param}")
    
        client = TestClient(mod.app)
        return client
    
    
    @pytest.mark.parametrize("price", ["50.5", 50.5])
    def test_post_with_tax(client: TestClient, price: Union[str, float]):
        response = client.post(
            "/items/",
            json={"name": "Foo", "price": price, "description": "Some Foo", "tax": 0.3},
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 5.3K bytes
    - Viewed (0)
  8. tests/test_request_params/test_path/test_required_str.py

    @app.get("/required-alias-and-validation-alias/{p_val_alias}")
    def read_required_alias_and_validation_alias(
        p: Annotated[str, Path(alias="p_alias", validation_alias="p_val_alias")],
    ):
        return {"p": p}
    
    
    @pytest.mark.parametrize(
        ("path", "expected_name", "expected_title"),
        [
            pytest.param("/required-str/{p}", "p", "P", id="required-str"),
            pytest.param(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 2.3K bytes
    - Viewed (0)
  9. tests/test_param_include_in_schema.py

    def test_openapi_schema():
        client = TestClient(app)
        response = client.get("/openapi.json")
        assert response.status_code == 200
        assert response.json() == openapi_schema
    
    
    @pytest.mark.parametrize(
        "path,cookies,expected_status,expected_response",
        [
            (
                "/hidden_cookie",
                {},
                200,
                {"hidden_cookie": None},
            ),
            (
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 7.4K bytes
    - Viewed (0)
  10. tests/test_file_and_form_order_issue_9116.py

        f.write_text("foo")
        return f
    
    
    @pytest.fixture
    def tmp_file_2(tmp_path: Path) -> Path:
        f = tmp_path / "example2.txt"
        f.write_text("bar")
        return f
    
    
    @pytest.mark.parametrize("endpoint_path", ("/file_before_form", "/file_after_form"))
    def test_file_form_order(endpoint_path: str, tmp_file_1: Path):
        response = client.post(
            url=endpoint_path,
            data={"city": "Thimphou"},
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 2.3K bytes
    - Viewed (0)
Back to top