From 52a51ca19e644ac60cd205445bc2c052c6624cce Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues Date: Fri, 17 Nov 2023 13:34:22 +0100 Subject: [PATCH] Add test for noPhotos --- tests/dec/test_dec.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/dec/test_dec.py b/tests/dec/test_dec.py index 0c0bcf86..198ec571 100644 --- a/tests/dec/test_dec.py +++ b/tests/dec/test_dec.py @@ -287,12 +287,33 @@ def test_list_lineshapePW_definitions(): def test_global_photos_flag(): + """ + Check that PHOTOS is on for all decays. + """ p = DecFileParser(DIR / "../data/defs-aliases-chargeconj.dec") p.parse() assert p.global_photos_flag() +def test_global_photos_off(): + """ + Check that PHOTOS is off for all decays. + """ + s = """ + # Turn off PHOTOS for all decays + noPhotos + + Decay D0 + 1.0 K- pi+ PHSP; + Enddecay + """ + p = DecFileParser.from_string(s) + p.parse() + + assert p.global_photos_flag() == PhotosEnum.no + + def test_missing_global_photos_flag(): p = DecFileParser(DIR / "../data/test_example_Dst.dec") p.parse() @@ -312,6 +333,7 @@ def test_duplicated_global_photos_flag(): """ p = DecFileParser.from_string(s) p.parse() + # The following call issues the warning # UserWarning: PHOTOS flag re-set! Using flag set in last ... # warnings.warn("PHOTOS flag re-set! Using flag set in last ...")