From 654e8acdbb76c1c499208ecd3f6a857e65106798 Mon Sep 17 00:00:00 2001 From: Manuel Franco Sevilla Date: Fri, 2 Aug 2024 13:58:15 -0400 Subject: [PATCH] Added full test of print_decay_mode --- src/decaylanguage/dec/dec.py | 2 +- tests/dec/test_dec.py | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/decaylanguage/dec/dec.py b/src/decaylanguage/dec/dec.py index 42055d6e..767ddadf 100644 --- a/src/decaylanguage/dec/dec.py +++ b/src/decaylanguage/dec/dec.py @@ -960,7 +960,7 @@ def print_decay_modes( dmdict = self._decay_mode_details(dm, display_photos_keyword) modelParsList = [str(i) for i in dmdict["model_params"]] model_params = "" if modelParsList == [] else " ".join(modelParsList) - decayChain = " ".join(dmdict["fs"]) + decayChain = " ".join(list(dmdict["fs"])) if len(decayChain) > maxLength: maxLength = len(decayChain) ls.append((dmdict["bf"], decayChain, dmdict["model"], model_params)) diff --git a/tests/dec/test_dec.py b/tests/dec/test_dec.py index e6399bff..48040b9c 100644 --- a/tests/dec/test_dec.py +++ b/tests/dec/test_dec.py @@ -515,7 +515,7 @@ def test_multiline_model(): def test_custom_model_name(): - p = DecFileParser("./tests/data/test_custom_decay_model.dec") + p = DecFileParser("../data/test_custom_decay_model.dec") p.load_additional_decay_models("CUSTOM_MODEL1", "CUSTOM_MODEL2") assert p.grammar() is not None @@ -590,6 +590,23 @@ def test_print_decay_modes_basics(): p.print_decay_modes("D*(2010)-", pdg_name=True) +def list_complement(l_m, l_s): + return [i for i in l_m if i not in l_s] + + +def test_print_decay_modes_full(): + p = DecFileParser(DIR / "../data/test_Bd2Dst0X_D02KPi.dec") + p.parse() + + decays = list_complement( + p.list_decay_mother_names(), p.list_charge_conjugate_decays() + ) + + for d in decays: + print(f"Decay {d}") + p.print_decay_modes(d, normalize=True) + + def test_print_decay_modes_options(): p1 = DecFileParser(DIR / "../data/test_example_Dst.dec") p1.parse()