From 66dd7ac659e83e8750bee3783bf81328347c0412 Mon Sep 17 00:00:00 2001 From: Cunliang Geng Date: Mon, 27 Nov 2023 11:15:18 +0100 Subject: [PATCH] update unit tests for `GNPSMolecularFamilyLoader` --- .../test_gnps_molecular_family_loader.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/metabolomics/test_gnps_molecular_family_loader.py b/tests/metabolomics/test_gnps_molecular_family_loader.py index cd428782..9f3ad4f3 100644 --- a/tests/metabolomics/test_gnps_molecular_family_loader.py +++ b/tests/metabolomics/test_gnps_molecular_family_loader.py @@ -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]