MCPcopy Index your code
hub / github.com/pyscript/pyscript / test_fetch_json

Function test_fetch_json

core/tests/python/tests/test_fetch.py:9–19  ·  view source on GitHub ↗

The fetch function should return the expected JSON response.

()

Source from the content-addressed store, hash-verified

7
8
9async def test_fetch_json():
10 """
11 The fetch function should return the expected JSON response.
12 """
13 response = await fetch("https://jsonplaceholder.typicode.com/todos/1")
14 assert response.ok
15 data = await response.json()
16 assert data["userId"] == 1
17 assert data["id"] == 1
18 assert data["title"] == "delectus aut autem"
19 assert data["completed"] is False
20
21
22async def test_fetch_json_direct():

Callers

nothing calls this directly

Calls 2

fetchFunction · 0.90
jsonMethod · 0.45

Tested by

no test coverage detected