Skip to content

Commit

Permalink
update unit tests for GNPSMolecularFamilyLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
CunliangGeng committed Dec 11, 2023
1 parent 9f66486 commit 66dd7ac
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/metabolomics/test_gnps_molecular_family_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,22 @@


@pytest.mark.parametrize(
"workflow, num_families, num_spectra",
[(GNPSFormat.SNETS, 25769, 19), (GNPSFormat.SNETSV2, 6902, 10), (GNPSFormat.FBMN, 1105, 5)],
"workflow, num_families, num_spectra, keep_singleton",
[
(GNPSFormat.SNETS, 25769, 19, True),
(GNPSFormat.SNETSV2, 6902, 10, True),
(GNPSFormat.FBMN, 1105, 5, True),
(GNPSFormat.SNETS, 29, 19, False),
(GNPSFormat.SNETSV2, 72, 10, False),
(GNPSFormat.FBMN, 60, 5, False),
],
)
def test_has_molecular_families(workflow, num_families, num_spectra, gnps_mf_files):
def test_gnps_molecular_family_loader(
workflow, num_families, num_spectra, keep_singleton, gnps_mf_files
):
"""Test GNPSMolecularFamilyLoader class."""
loader = GNPSMolecularFamilyLoader(gnps_mf_files[workflow])
actual = loader.get_mfs
actual = loader.get_mfs(keep_singleton=keep_singleton)
assert len(actual) == num_families
# test molecular family with id "1" has correct number of spectra ids
mf = [mf for mf in actual if mf.family_id == "1"][0]
Expand Down

0 comments on commit 66dd7ac

Please sign in to comment.