MCPcopy
hub / github.com/encode/starlette / test_datetime_convertor

Function test_datetime_convertor

tests/test_convertors.py:52–59  ·  view source on GitHub ↗
(test_client_factory: TestClientFactory, app: Router)

Source from the content-addressed store, hash-verified

50
51
52def test_datetime_convertor(test_client_factory: TestClientFactory, app: Router) -> None:
53 client = test_client_factory(app)
54 response = client.get("/datetime/2020-01-01T00:00:00")
55 assert response.json() == {"datetime": "2020-01-01T00:00:00"}
56
57 assert (
58 app.url_path_for("datetime-convertor", param=datetime(1996, 1, 22, 23, 0, 0)) == "/datetime/1996-01-22T23:00:00"
59 )
60
61
62@pytest.mark.parametrize("param, status_code", [("1.0", 200), ("1-0", 404)])

Callers

nothing calls this directly

Calls 4

test_client_factoryFunction · 0.85
jsonMethod · 0.80
getMethod · 0.45
url_path_forMethod · 0.45

Tested by

no test coverage detected