Spaces:
Sleeping
Sleeping
File size: 524 Bytes
b7a913f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 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
|