From ffe805dd595ced4bb7e420f2657ceee40798507f Mon Sep 17 00:00:00 2001 From: niekdejonge Date: Wed, 7 Aug 2024 12:54:42 +0200 Subject: [PATCH] Added test, to detect bug. --- tests/test_add_classifier_annotations.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_add_classifier_annotations.py b/tests/test_add_classifier_annotations.py index f6852cdf..8b05b8f2 100644 --- a/tests/test_add_classifier_annotations.py +++ b/tests/test_add_classifier_annotations.py @@ -23,3 +23,10 @@ def test_add_classifier_annotation(spectra): result = select_compound_classes(spectra) assert sorted(result) == [['WRIPSIKIDAUKBP', 'Organic compounds', 'Phenylpropanoids and polyketides', 'Macrolactams', '', 'Macrolactams', '', '', 'Alkaloids', 'False'], ['WXDBUBIFYCCNLE', 'Organic compounds', 'Organoheterocyclic compounds', 'Oxepanes', '', 'Oxepanes', 'Lipopeptides', 'Oligopeptides', 'Amino acids and Peptides', 'False']] + + +def test_add_classifier_annotation_unknown_inchikey(spectra): + """This tests that when no compound class annotation is found, that it is correctly filled with empty strings""" + spectra[1].set("inchikey", "AAAAAAAAAAAAAA") + result = select_compound_classes(spectra) + assert len(result[0]) == len(result[1])