Spaces:
Running
Running
Download tests/test_validation.py from Leon4gr45/needle: direct link, hf CLI and curl.
- Browser
- Download file 963 Bytes
-
https://huggingface.co/spaces/Leon4gr45/needle/resolve/main/tests/test_validation.py
- Command line
-
hf download hf://spaces/Leon4gr45/needle/tests/test_validation.py
-
curl -L -o test_validation.py https://huggingface.co/spaces/Leon4gr45/needle/resolve/main/tests/test_validation.py
963 Bytes
| import pytest | |
| from registry import normalize_tool | |
| def test_normalization_native(): | |
| raw = {"name": "test", "description": "desc", "parameters": {"type": "object"}} | |
| normalized = normalize_tool(raw) | |
| assert normalized["name"] == "test" | |
| assert normalized["description"] == "desc" | |
| assert "parameters" in normalized | |
| def test_normalization_openai(): | |
| raw = { | |
| "type": "function", | |
| "function": { | |
| "name": "test_fn", | |
| "description": "fn desc", | |
| "parameters": {"type": "object"} | |
| } | |
| } | |
| normalized = normalize_tool(raw) | |
| assert normalized["name"] == "test_fn" | |
| assert normalized["description"] == "fn desc" | |
| assert "parameters" in normalized | |
| def test_normalization_optional_params(): | |
| # parameters are optional and fallback to object | |
| raw = {"name": "test", "description": "desc"} | |
| normalized = normalize_tool(raw) | |
| assert normalized["parameters"]["type"] == "object" | |