-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for CatalogTable.as_list_of_dicts (#1319)
* Implemented test case with empty and standard input. * Updated README.md for input folder inside test. * Changed the input file structure to organize test inputs better for different test cases.
- Loading branch information
Daud Ahmed
committed
Oct 23, 2024
1 parent
b0b300e
commit a3741d2
Showing
10 changed files
with
147 additions
and
33 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,102 @@ | ||
[ | ||
{ | ||
"Identifier": "eos1579", | ||
"Slug": "metabokiller", | ||
"Title": "Carcinogenic potential of metabolites and small molecules" | ||
}, | ||
{ | ||
"Identifier": "eos157v", | ||
"Slug": "grover-freesolv", | ||
"Title": "Hydration free energy of small molecules in water" | ||
}, | ||
{ | ||
"Identifier": "eos18ie", | ||
"Slug": "antibiotics-ai", | ||
"Title": "Substructure-based search of novel antibiotics" | ||
}, | ||
{ | ||
"Identifier": "eos1af5", | ||
"Slug": "molgrad-caco2", | ||
"Title": "Coloring molecules for Caco-2 cell permeability" | ||
}, | ||
{ | ||
"Identifier": "eos1amn", | ||
"Slug": null, | ||
"Title": "3D pharmacophore descriptor" | ||
}, | ||
{ | ||
"Identifier": "eos1amr", | ||
"Slug": "grover-bbbp", | ||
"Title": "Blood-brain barrier penetration" | ||
}, | ||
{ | ||
"Identifier": "eos1bba", | ||
"Slug": null, | ||
"Title": "GeoGNN Molecular Representation Prediction" | ||
}, | ||
{ | ||
"Identifier": "eos1d7r", | ||
"Slug": "small-world-zinc", | ||
"Title": "Small World Zinc search" | ||
}, | ||
{ | ||
"Identifier": "eos1mxi", | ||
"Slug": "smiles-pe", | ||
"Title": "SmilesPE: tokenizer algorithm for SMILES, DeepSMILES, and SELFIES" | ||
}, | ||
{ | ||
"Identifier": "eos1n4b", | ||
"Slug": "hdac3-inh", | ||
"Title": "Identifying HDAC3 inhibitors" | ||
}, | ||
{ | ||
"Identifier": "eos1noy", | ||
"Slug": "chembl-sampler", | ||
"Title": "ChEMBL Molecular Sampler" | ||
}, | ||
{ | ||
"Identifier": "eos1pu1", | ||
"Slug": "cardiotox-dictrank", | ||
"Title": "Cardiotoxicity Classifier" | ||
}, | ||
{ | ||
"Identifier": "eos1ut3", | ||
"Slug": "molfeat-usrcat", | ||
"Title": "USR descriptors with pharmacophoric constraints" | ||
}, | ||
{ | ||
"Identifier": "eos1vms", | ||
"Slug": "chembl-multitask-descriptor", | ||
"Title": "Multi-target prediction based on ChEMBL data" | ||
}, | ||
{ | ||
"Identifier": "eos1xje", | ||
"Slug": "biogpt-embeddings", | ||
"Title": "BioGPT embeddings" | ||
}, | ||
{ | ||
"Identifier": "eos21q7", | ||
"Slug": "inter_dili", | ||
"Title": "InterDILI: drug-induced injury prediction" | ||
}, | ||
{ | ||
"Identifier": "eos22io", | ||
"Slug": "idl-ppbopt", | ||
"Title": "Human Plasma Protein Binding (PPB) of Compounds" | ||
}, | ||
{ | ||
"Identifier": "eos238c", | ||
"Slug": "mesh-therapeutic-use", | ||
"Title": "MeSH therapeutic use based on chemical structure" | ||
}, | ||
{ | ||
"Identifier": "eos2401", | ||
"Slug": "scaffold-decoration", | ||
"Title": "Scaffold decoration" | ||
}, | ||
{ | ||
"Identifier": "eos24ci", | ||
"Slug": "drugtax", | ||
"Title": "DrugTax: Drug taxonomy" | ||
} | ||
] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,24 @@ | ||
import json | ||
import os | ||
import pytest | ||
from ersilia.hub.content.catalog import CatalogTable | ||
|
||
@pytest.fixture | ||
def catalog_samples(): | ||
file_path = os.path.join(os.path.dirname(__file__), 'inputs', 'catalog_samples.json') | ||
with open(file_path, 'r') as f: | ||
samples = json.load(f) | ||
return samples | ||
|
||
def test_as_list_of_dicts(catalog_samples): | ||
columns = ['Identifier', 'Slug', 'Title'] | ||
|
||
# Test with standard catalog samples | ||
catalog_table = CatalogTable(data=[list(item.values()) for item in catalog_samples], columns=columns) | ||
result = catalog_table.as_list_of_dicts() | ||
assert result == catalog_samples, "The result does not match the expected catalog samples" | ||
|
||
# Test with empty catalog data | ||
catalog_table_empty = CatalogTable(data=[], columns=columns) | ||
result_empty = catalog_table_empty.as_list_of_dicts() | ||
assert result_empty == [], "The result should be an empty list for empty input data" |