-
Notifications
You must be signed in to change notification settings - Fork 7
Improving test case #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I have created the initial PR for test cases, but it has some issue, test cases is not passing currently, anyone can help me in that how to improve this. |
Hey @abhijeetSaroha I was thinking if instead of adding a mock test for avoiding the ci not selecting any tests. We could implement a test for the utils module by creating Here is how it would look like """Tests for anamnesisai package utility module."""
import pytest
from typing import Type
from fhir.resources.resource import Resource
from anamnesisai.utils import get_resource_detail
class MockResource(Resource): # type: ignore[misc]
"""Disclaimer: Any field name ends with ``__ext`` doesn't part of
Resource StructureDefinition, instead used to enable Extensibility feature
for FHIR Primitive Data Types.
MOCK RESOURCE FOR TESTING PURPOSES ONLY.
This is a simulated DomainResource used to test resource handling functionality.
It mimics the structure of a real FHIR resource but contains no actual implementation.
"""
@pytest.fixture
def resource() -> Type[Resource]:
"""Mock Resource fixture.""" # noqa: D202
return MockResource
def test_get_resource_detail(resource: Type[Resource]) -> None:
"""Test get_resource_detail function."""
expected = (
"MOCK RESOURCE FOR TESTING PURPOSES ONLY. "
"This is a simulated DomainResource used to test "
"resource handling functionality. It mimics the "
"structure of a real FHIR resource but contains no "
"actual implementation."
)
assert get_resource_detail(resource) == expected ps. I has to add This should be enough to avoid the non tests selected error. You can try it locally by running |
6724b7b
to
5ab342a
Compare
LGTM @abhijeetSaroha ! Did it run ok locally? |
|
||
for filename, content in synthetic_files_content.items(): | ||
print(f"Testing synthetic file: {filename}") | ||
fhir_data = aai.extract_fhir(content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be quite expensive, running the extract_fhr_resources against all synthetic files would take a lot of time and api calls.
with open(random_file, "r") as f: | ||
transcript_content = f.read() | ||
|
||
api_key = openai_api_key if backend == "openai" else "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future we may need another fixture to get the api key from a dictionary where the key will be the backend literal and the value will be the API_KEY from .env, but right now I don't think it's necessary. We can do that once we implement ollama and/or other LLMs
No description provided.