diff options
author | Alexander_Kabui | 2024-08-30 17:32:49 +0300 |
---|---|---|
committer | Alexander_Kabui | 2024-08-30 17:32:49 +0300 |
commit | e7d55031ed35819b54483744912719ef6c0cb5b9 (patch) | |
tree | 465a0b5954ee153565c1dba8c7e2f4f385fe9b97 /tests/unit/test_llm.py | |
parent | 1cb8b2c3b242522461f7db98008a9e7e882bee9a (diff) | |
parent | 25345b327f319c49798cef208be950e25f447da6 (diff) | |
download | genenetwork3-e7d55031ed35819b54483744912719ef6c0cb5b9.tar.gz |
Fix merge conflict.
Diffstat (limited to 'tests/unit/test_llm.py')
-rw-r--r-- | tests/unit/test_llm.py | 70 |
1 files changed, 1 insertions, 69 deletions
diff --git a/tests/unit/test_llm.py b/tests/unit/test_llm.py index 7b8a970..c32e888 100644 --- a/tests/unit/test_llm.py +++ b/tests/unit/test_llm.py @@ -1,8 +1,5 @@ -# pylint: disable=unused-argument -"""Test cases for procedures defined in llms module""" -from dataclasses import dataclass +"""Test cases for procedures defined in llms """ import pytest -from gn3.llms.process import get_gnqa from gn3.llms.process import parse_context @@ -35,68 +32,3 @@ def test_parse_context(): ] assert parsed_result == expected_result - - -@dataclass(frozen=True) -class MockResponse: - """mock a response object""" - text: str - - def __getattr__(self, name: str): - return self.__dict__[f"_{name}"] - - -class MockGeneNetworkQAClient: - """mock the GeneNetworkQAClient class""" - - def __init__(self, session, api_key): - pass - - def ask(self, query, auth_token): - """mock method for ask query""" - # Simulate the ask method - return MockResponse("Mock response"), "F400995EAFE104EA72A5927CE10C73B7" - - def get_answer(self, task_id): - """mock get_answer method""" - return MockResponse("Mock answer"), 1 - - -def mock_filter_response_text(text): - """ method to simulate the filterResponseText method""" - return {"data": {"answer": "Mock answer for what is a gene", "context": {}}} - - -def mock_parse_context(context, get_info_func, format_bib_func): - """method to simulate the parse context method""" - return [] - - -@pytest.mark.unit_test -def test_get_gnqa(monkeypatch): - """test for process.get_gnqa functoin""" - monkeypatch.setattr( - "gn3.llms.process.GeneNetworkQAClient", - MockGeneNetworkQAClient - ) - - monkeypatch.setattr( - 'gn3.llms.process.filter_response_text', - mock_filter_response_text - ) - monkeypatch.setattr( - 'gn3.llms.process.parse_context', - mock_parse_context - ) - - query = "What is a gene" - auth_token = "test_token" - result = get_gnqa(query, auth_token) - - expected_result = ( - "F400995EAFE104EA72A5927CE10C73B7", - 'Mock answer for what is a gene', - [] - ) - - assert result == expected_result |