This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 736
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added tests and fixed datatype error arising from passing dict to Doc…
…ument
- Loading branch information
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pytest | ||
from llama_hub.pdb.base import PdbAbstractReader | ||
from llama_index.readers.schema.base import Document | ||
|
||
|
||
@pytest.mark.parametrize("pdb_ids", [["1cbs", "125L"]]) # Example PDB ids to test | ||
def test_load_data(pdb_ids): | ||
# Create an instance of the PdbAbstractReader class | ||
reader = PdbAbstractReader() | ||
|
||
# Call the load_data method with the test PDB ids | ||
documents = reader.load_data(pdb_ids) | ||
|
||
# Assert that the returned documents have the expected structure | ||
assert isinstance(documents, list) | ||
assert all(isinstance(doc, Document) for doc in documents) | ||
assert all(doc.text is not None for doc in documents) | ||
assert all(isinstance(doc.extra_info, dict) for doc in documents) | ||
assert all("pdb_id" in doc.extra_info for doc in documents) | ||
assert all("primary_citation" in doc.extra_info for doc in documents) |