Spaces:
Sleeping
Sleeping
Download tests/test_json_utils.py from mjpsm/activity-progression-api: direct link, hf CLI and curl.
- Browser
- Download file 462 Bytes
-
https://huggingface.co/spaces/mjpsm/activity-progression-api/resolve/main/tests/test_json_utils.py
- Command line
-
hf download hf://spaces/mjpsm/activity-progression-api/tests/test_json_utils.py
-
curl -L -o test_json_utils.py https://huggingface.co/spaces/mjpsm/activity-progression-api/resolve/main/tests/test_json_utils.py
462 Bytes
| from app.json_utils import extract_json | |
| def test_clean_json(): | |
| assert extract_json('{"progression":{"a":1}}') == { | |
| "progression": {"a": 1}, | |
| } | |
| def test_text_before_and_after_json(): | |
| text = 'Here is the result:\n{"progression":{"a":1}}\nDone.' | |
| assert extract_json(text) == {"progression": {"a": 1}} | |
| def test_malformed_json(): | |
| assert extract_json('{"progression": {"a": 1') is None | |
| assert extract_json("no json here") is None | |