Spaces:
Sleeping
Sleeping
Download test/test_app.py from iscg34/finalproject: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/iscg34/finalproject/resolve/refs%2Fpr%2F2/test/test_app.py
- Command line
-
hf download hf://spaces/iscg34/finalproject@refs/pr/2/test/test_app.py
-
curl -L -o test_app.py https://huggingface.co/spaces/iscg34/finalproject/resolve/refs%2Fpr%2F2/test/test_app.py
1.02 kB
| import unittest | |
| from unittest.mock import MagicMock, create_autospec | |
| from data_service import DataService | |
| from llm_service import LLMService | |
| from g34_final_project import App | |
| class TestApp(unittest.TestCase): | |
| def test_app(self): | |
| mock_tmp = MagicMock() | |
| mock_tmp.return_value.__enter__.return_value = create_autospec(DataService) | |
| with mock_tmp() as data_service, LLMService().with_key("").build() as llm_service: | |
| data_service.get_patients = MagicMock(return_value=["kareem", "abdul", "jabbar"]) | |
| llm_service.get_summary = MagicMock(return_value="This is a summary") | |
| llm_service.answer_query = MagicMock(return_value="This is the query answer") | |
| llm_service.close = MagicMock(return_value=None) | |
| app = App(data_service, llm_service) | |
| app.launch() | |
| # TODO: This is probably not a good way to test. Maybe there isn't one for this. I just wanted to put a stub here. But it would be nice to be able to test things like "it accessed the data service get_patients once", etc. |