Spaces:
Sleeping
Sleeping
| import os | |
| os.environ["MOCK_INFERENCE"] = "true" | |
| from fastapi.testclient import TestClient | |
| from app import app | |
| client = TestClient(app) | |
| def test_tokenize(): | |
| payload = { | |
| "model": "plain-llama-3-8b", | |
| "text": "This is a test sentence." | |
| } | |
| response = client.post("/v1/tokenize", json=payload) | |
| assert response.status_code == 200 | |
| json_data = response.json() | |
| assert json_data["model"] == "plain-llama-3-8b" | |
| assert "token_count" in json_data | |
| assert json_data["token_count"] > 0 | |