def test_given_date_contains_proper_day_ids(date_, tempora, celebration, commemoration): assert tempora == [ i.id for i in get_missal(date_[0]).get_day(date(*date_)).tempora ] assert celebration == [ i.id for i in get_missal(date_[0]).get_day(date(*date_)).celebration ] assert commemoration == [ i.id for i in get_missal(date_[0]).get_day(date(*date_)).commemoration ]
def test_get_repr(): missal = get_missal(2018, language) container = missal.get_day(date(2018, 1, 13)) assert 'Sobota po 1 Niedzieli po Objawieniu' in container.get_tempora_name( ) assert 'Wspomnienie Chrztu Pańskiego' in container.get_celebration_name() assert str(container) == '[<tempora:Epi1-6:4:w>][<sancti:01-13:2:w>][]'
def test_conflicts(date_, expected_celebration, expected_commemoration): missal = get_missal(date_[0]) assert expected_celebration == [ i.id for i in missal.get_day(date(*date_)).celebration ] assert expected_commemoration == [ i.id for i in missal.get_day(date(*date_)).commemoration ]
def test_excluded_commemorations(date_): missal = get_missal(date_[0], language) proper_vernacular, proper_latin = missal.get_day( date(*date_)).get_proper()[0] for stripped_section in (COMMEMORATED_ORATIO, COMMEMORATED_SECRETA, COMMEMORATED_POSTCOMMUNIO): assert None is proper_vernacular.get_section(stripped_section) assert None is proper_latin.get_section(stripped_section)
def test_get_proper_from_day(): missal = get_missal(2018, language) proper_vernacular, proper_latin = missal.get_day(date(2018, 1, 6)).get_proper()[0] assert 'Objawienie' in proper_vernacular.title assert 'Ml 3:1' in proper_vernacular.get_section(INTROIT).body[0] assert 'Malach 3:1' in proper_latin.get_section(INTROIT).body[0] assert 'Deus, qui hodiérna die' in proper_latin.get_section(ORATIO).body[0]
def test_all_propers_english(strdate, expected_sections): missal = get_missal(2020, 'en') day = missal.get_day(date(*[int(i) for i in strdate.split('-')])) tempora_name = day.get_tempora_name() proper, _ = day.get_proper()[0] proper_serialized = proper.serialize() for i, expected_section in enumerate(expected_sections): assert expected_section['id'] == proper_serialized[i]['id'], \ f'english {tempora_name or proper.title}/{strdate}/{expected_section["id"]}' assert expected_section['body'] in proper_serialized[i]['body'], \ f'english {tempora_name or proper.title}/{strdate}/{expected_section["id"]}'
def test_tract_stripped_in_gradual_in_feria_day_using_sunday_proper( date_, stripped): missal = get_missal(date_[0], language) proper_vernacular, proper_latin = missal.get_day( date(*date_)).get_proper()[0] gradual_vernacular = proper_vernacular.get_section(GRADUALE).body gradual_latin = proper_latin.get_section(GRADUALE).body assert any([ re.search(re.compile(PATTERN_TRACT), i) for i in gradual_vernacular + gradual_latin ]) is not stripped
def test_alleluia_stripped_in_gradual_in_feria_day_using_sunday_proper( date_, stripped): missal = get_missal(date_[0], language) proper_vernacular, proper_latin = missal.get_day( date(*date_)).get_proper()[0] gradual_vernacular = proper_vernacular.get_section(GRADUALE).body gradual_latin = proper_latin.get_section(GRADUALE).body assert any([ PATTERN_ALLELUIA.search(i, re.I) for i in gradual_vernacular + gradual_latin ]) is not stripped
def test_correct_gradual_tract_depending_on_the_season(date_, title_part, sections_present, sections_absent): missal = get_missal(date_[0], language) proper_vernacular, proper_latin = missal.get_day( date(*date_)).get_proper()[0] assert title_part in proper_vernacular.title for section in sections_present: assert proper_vernacular.get_section(section) is not None assert proper_latin.get_section(section) is not None for section in sections_absent: assert proper_vernacular.get_section(section) is None assert proper_latin.get_section(section) is None
def test_sundays_shifted_from_post_epiphany_to_post_pentecost_have_proper_sections( date_, introit, collect, lectio, gradual, evangelium, offertorium, secreta, communio, postcommunio): missal = get_missal(date_[0], language) proper_vernacular, proper_latin = missal.get_day( date(*date_)).get_proper()[0] assert introit in proper_latin.get_section(INTROIT).body[0] assert collect in proper_latin.get_section(ORATIO).body[0] assert lectio in proper_latin.get_section(LECTIO).body[1] assert gradual in proper_latin.get_section(GRADUALE).body[0] assert evangelium in proper_latin.get_section(EVANGELIUM).body[1] assert offertorium in proper_latin.get_section(OFFERTORIUM).body[0] assert secreta in proper_latin.get_section(SECRETA).body[0] assert communio in proper_latin.get_section(COMMUNIO).body[0]
def test_calculated_commemorations(date_, collect_contains, secreta_contains, postcommunio_contains, comm_collect_sub, comm_collect_contains, comm_secreta_contains, comm_postcommunio_contains): missal = get_missal(date_[0], language) proper_vernacular, proper_latin = missal.get_day( date(*date_)).get_proper()[0] assert collect_contains in proper_latin.get_section(ORATIO).body[0] assert comm_collect_contains in proper_latin.get_section( COMMEMORATED_ORATIO).body[1] assert comm_collect_sub in proper_latin.get_section( COMMEMORATED_ORATIO).body[0] assert secreta_contains in proper_latin.get_section(SECRETA).body[0] assert comm_secreta_contains in proper_latin.get_section( COMMEMORATED_SECRETA).body[1] assert postcommunio_contains in proper_latin.get_section( POSTCOMMUNIO).body[0] assert comm_postcommunio_contains in proper_latin.get_section( COMMEMORATED_POSTCOMMUNIO).body[1]
def test_tempora(year, dates): missal = get_missal(int(year)) assert _to_date_obj(dates[0]) == missal.find_day(c.TEMPORA_QUADP1_0)[0] assert _to_date_obj(dates[1]) == missal.find_day(c.TEMPORA_QUADP3_3)[0] assert _to_date_obj(dates[2]) == missal.find_day(c.TEMPORA_PASC0_0)[0] assert _to_date_obj(dates[3]) == missal.find_day(c.TEMPORA_PASC5_4)[0] assert _to_date_obj(dates[4]) == missal.find_day(c.TEMPORA_PASC7_0)[0] assert _to_date_obj(dates[5]) == missal.find_day(c.TEMPORA_PENT01_4)[0] assert _to_date_obj(dates[6]) == missal.find_day(c.TEMPORA_ADV1_0)[0] # TEMPORA_EPI4_0 might not exist in given year, then None is returned actual = missal.find_day(c.TEMPORA_EPI4_0)[0] if \ missal.find_day(c.TEMPORA_EPI4_0) else None assert _to_date_obj(dates[7]) == actual assert _to_date_obj(dates[8]) == missal.find_day(c.TEMPORA_PENT_6)[0] assert _to_date_obj(dates[9]) == missal.find_day(c.TEMPORA_NAT2_0)[0] assert _to_date_obj(dates[10]) == missal.find_day(c.SANCTI_10_DUr)[0] # NAT1_0 might not exist in given year, then None is returned actual = missal.find_day(c.TEMPORA_NAT1_0)[0] if \ missal.find_day(c.TEMPORA_NAT1_0) else None assert _to_date_obj(dates[11]) == actual
def test_sancti_shifted(day_id, expected_date): assert date(*expected_date) == get_missal( expected_date[0]).find_day(day_id)[0]
def test_ignored_sections(date_, sections): missal = get_missal(date_[0], language) _, proper_latin = missal.get_day(date(*date_)).get_proper()[0] for section in sections: assert proper_latin.get_section(section) is None
def test_given_date_does_not_contain_day_ids(date_, not_expected_day_ids): assert not match( get_missal(date_[0]).get_day(date(*date_)).all, not_expected_day_ids)
def test_correct_preface_calculated_by_date(date_, title_part, preface_body): missal = get_missal(date_[0], language) proper_vernacular, proper_latin = missal.get_day( date(*date_)).get_proper()[0] assert title_part in proper_vernacular.title assert preface_body == proper_latin.get_section(PREFATIO).get_body()[0]
def test_get_proper_for_day_without_own_proper(date_, id_, rank): # For days without their own propers we show the proper from the last Sunday missal = get_missal(date_[0], language) _, proper_latin = missal.get_day(date(*date_)).get_proper()[0] assert id_ == proper_latin.id == id_ assert rank == proper_latin.rank