示例#1
0
 def get_proper(self, config=None) -> Tuple['Proper', 'Proper']:
     proper: Tuple['Proper',
                   'Proper'] = ProperParser(self.id, self.lang,
                                            config).parse()
     if re.match(PATTERN_POST_EPIPHANY_SUNDAY,
                 self.id) and self.date.month >= 10:
         self._adjust_sunday_shifted_from_post_epiphany(proper)
     return proper
示例#2
0
 def _adjust_sunday_shifted_from_post_epiphany(self, propers: Tuple['Proper', 'Proper']) \
         -> Tuple['Proper', 'Proper']:
     """
     When Easter is early (e.g. 2018), Pre-lent takes up some Sundays after Epiphany, which in turn
     are shifted to the end of the period after Pentecost. In such case, each shifted Sunday is modified
     in following way:
       * Introit, Gradual, Offertorium and Communio are taken from 23rd Sunday after Pentecost
       * Collect, Lectio, Evangelium and Secreta are taken from respective shifted Sunday
     """
     proper_sunday_23_post_pentecost: Tuple['Proper',
                                            'Proper'] = ProperParser(
                                                TEMPORA_PENT23_0,
                                                self.lang).parse()
     for i, proper in enumerate(propers):
         for section in (INTROIT, GRADUALE, OFFERTORIUM, COMMUNIO):
             proper.set_section(
                 section,
                 proper_sunday_23_post_pentecost[i].get_section(section))
示例#3
0
def get_proper_by_id(proper_id: str, lang: str) -> Tuple[Proper, Proper]:
    config: ProperConfig = ProperConfig(
        preface=get_custom_preface(Proper(proper_id, lang)))
    return ProperParser(proper_id, lang, config).parse()
示例#4
0
 def has_proper(self) -> bool:
     return ProperParser(self.id, self.lang).proper_exists()
示例#5
0
def test_parse_proper_ref_outside_sections():
    proper_vernacular, proper_latin = ProperParser(c.SANCTI_10_DUr,
                                                   language).parse()
    assert 'Chrystusa Króla' in proper_vernacular.title
    assert '*Ap 5:12; 1:6*' in proper_vernacular.get_section(INTROIT).body[0]
    assert '*Apoc 5:12; 1:6*' in proper_latin.get_section(INTROIT).body[0]
示例#6
0
def test_parse_proper_refs_inside_sections_and_in_vide():
    proper_vernacular, proper_latin = ProperParser(c.SANCTI_01_22,
                                                   language).parse()

    assert 'Śś. Wincentego' in proper_vernacular.title
    assert '*Ps 78:11-12; 78:10*' in proper_vernacular.get_section(
        INTROIT).body[0]
    assert 'Przychyl się, Panie,' in proper_vernacular.get_section(
        ORATIO).body[0]
    assert '*Mdr 3:1-8*' in proper_vernacular.get_section(LECTIO).body[1]
    assert '*Wj 15:11*' in proper_vernacular.get_section(GRADUALE).body[0]
    assert '*Wj 15:11*' in proper_vernacular.get_section(TRACTUS).body[0]
    assert '*Łk 21:9-19*' in proper_vernacular.get_section(EVANGELIUM).body[1]
    assert '*Ps 67:36*' in proper_vernacular.get_section(OFFERTORIUM).body[0]
    assert 'Ofiarujemy Ci, Panie, te dary' in proper_vernacular.get_section(
        SECRETA).body[0]
    assert '*Mdr 3:4-6*' in proper_vernacular.get_section(COMMUNIO).body[0]
    assert 'Prosimy Cię, wszechmogący' in proper_vernacular.get_section(
        POSTCOMMUNIO).body[0]
    assert 'Prefacja zwykła' in proper_vernacular.get_section(PREFATIO).body[0]

    assert '*Ps 78:11-12; 78:10*' in proper_latin.get_section(INTROIT).body[0]
    assert 'Adésto, Dómine, supplicatiónibus' in proper_latin.get_section(
        ORATIO).body[0]
    assert '*Sap 3:1-8*' in proper_latin.get_section(LECTIO).body[1]
    assert '*Exod 15:11*' in proper_latin.get_section(GRADUALE).body[0]
    assert '*Exod 15:11*' in proper_latin.get_section(TRACTUS).body[0]
    assert '*Luc 21:9-19*' in proper_latin.get_section(EVANGELIUM).body[1]
    assert '*Ps 67:36*' in proper_latin.get_section(OFFERTORIUM).body[0]
    assert 'Múnera tibi, Dómine,' in proper_latin.get_section(SECRETA).body[0]
    assert '*Sap 3:4-6*' in proper_latin.get_section(COMMUNIO).body[0]
    assert 'Quǽsumus, omnípotens Deus:' in proper_latin.get_section(
        POSTCOMMUNIO).body[0]
    assert '*Communis*' in proper_latin.get_section(PREFATIO).body[0]
示例#7
0
def test_correct_preface_calculated_by_proper_id(proper_id, preface_name,
                                                 preface_body):
    _, proper_latin = ProperParser(proper_id, language,
                                   ProperConfig(preface=preface_name)).parse()
    assert preface_body == proper_latin.get_section(PREFATIO).get_body()[0]
示例#8
0
def test_parse_proper_no_refs():
    proper_vernacular, proper_latin = ProperParser(c.SANCTI_01_06,
                                                   language).parse()

    assert 'Objawienie' in proper_vernacular.title
    assert 1 == proper_vernacular.rank
    assert '«Obchodzimy dzień święty' in proper_vernacular.description
    assert 'Stacja u Św. Piotra' in proper_vernacular.additional_info
    assert 'Szaty białe' in proper_vernacular.additional_info
    assert 'Ml 3:1' in proper_vernacular.get_section(INTROIT).body[0]
    assert 'Boże, w dniu dzisiejszym' in proper_vernacular.get_section(
        ORATIO).body[0]
    assert '*Iz 60:1-6*' in proper_vernacular.get_section(LECTIO).body[1]
    assert 'Iz 60:6; 60:1' in proper_vernacular.get_section(GRADUALE).body[0]
    assert '*Mt 2:1-12*' in proper_vernacular.get_section(EVANGELIUM).body[1]
    assert 'Ps 71:10-11' in proper_vernacular.get_section(OFFERTORIUM).body[0]
    assert 'Wejrzyj miłościwie' in proper_vernacular.get_section(
        SECRETA).body[0]
    assert 'Mt 2:2' in proper_vernacular.get_section(COMMUNIO).body[0]
    assert 'Spraw, prosimy,' in proper_vernacular.get_section(
        POSTCOMMUNIO).body[0]
    assert 'Prefacja o Objawieniu' in proper_vernacular.get_section(
        PREFATIO).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]
    assert '*Is 60:1-6*' in proper_latin.get_section(LECTIO).body[1]
    assert '*Isa 60:6; 60:1*' in proper_latin.get_section(GRADUALE).body[0]
    assert '*Matt 2:1-12*' in proper_latin.get_section(EVANGELIUM).body[1]
    assert '*Ps 71:10-11*' in proper_latin.get_section(OFFERTORIUM).body[0]
    assert 'Ecclésiæ tuæ, quǽsumus' in proper_latin.get_section(
        SECRETA).body[0]
    assert '*Matt 2:2*' in proper_latin.get_section(COMMUNIO).body[0]
    assert 'Præsta, quǽsumus, omnípotens' in proper_latin.get_section(
        POSTCOMMUNIO).body[0]
    assert '*de Epiphania Domini*' in proper_latin.get_section(
        PREFATIO).body[0]
示例#9
0
def test_proper_not_found():
    with pytest.raises(ProperNotFound):
        ProperParser('tempora:bla', language).parse()
示例#10
0
def test_invalid_proper_id():
    with pytest.raises(InvalidInput):
        ProperParser('bla', language).parse()