Skip to content

Commit

Permalink
Added full test of print_decay_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelfs committed Aug 2, 2024
1 parent 36298c3 commit 654e8ac
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/decaylanguage/dec/dec.py
Original file line number Diff line number Diff line change
@@ -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))
19 changes: 18 additions & 1 deletion tests/dec/test_dec.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 654e8ac

Please sign in to comment.