Browse Source

test: finalize client fixture and absolute import for needs_pydanticv2

pull/14322/head
Chaitanya Sai Meka 7 months ago
committed by Yurii Motov
parent
commit
b960384f3f
  1. 11
      tests/test_tutorial/test_query_params_str_validations/test_tutorial006d_an_py310.py

11
tests/test_tutorial/test_query_params_str_validations/test_tutorial006d_an_py310.py

@ -1,11 +1,14 @@
import pytest
from fastapi.testclient import TestClient
from tests.utils import needs_pydanticv2
from docs_src.query_params_str_validations.tutorial006d_an_py310 import app
client = TestClient(app)
@pytest.fixture
def client():
from docs_src.query_params_str_validations.tutorial006d_an_py310 import app
yield TestClient(app)
@needs_pydanticv2
@pytest.mark.parametrize(
"q_value,expected",
[
@ -15,7 +18,7 @@ client = TestClient(app)
("hello", "hello"),
],
)
def test_read_items(q_value, expected):
def test_read_items(q_value, expected, client: TestClient):
response = client.get("/items/", params={"q": q_value})
assert response.status_code == 200
assert response.json() == {"q": expected}

Loading…
Cancel
Save