Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

test_serve.py 1.0 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  1. import json
  2. import pytest
  3. from src.serve.serve import app
  4. import src.serve.serve as serve
  5. @pytest.fixture
  6. def client():
  7. with app.test_client() as client:
  8. yield client
  9. """ def test_predict_air(client):
  10. serve.dowload_models()
  11. with open('tests/test_data.json', 'r') as file:
  12. data = json.load(file)
  13. response = client.post('/predict', json=data)
  14. assert response.status_code == 200
  15. response_data = response.get_json()
  16. assert 'prediction' in response_data
  17. assert isinstance(response_data['prediction'], list)
  18. assert len(response_data['prediction']) == 1
  19. assert 'prediction' in response_data """
  20. def test_get_predictions(client):
  21. serve.dowload_models()
  22. response = client.get('/predict/1') # Assuming station 1 is being tested
  23. assert response.status_code == 200
  24. response_data = response.get_json()
  25. assert 'predictions' in response_data
  26. assert isinstance(response_data['predictions'], list)
  27. assert len(response_data['predictions']) == 7
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...