Example #1
0
def test_get_day():
    jan1 = data.get_day(1, 1)
    assert len(jan1) == 2
    assert {d['citation'] for d in jan1} == {"WLC 1", "WSC 1"}

    jan2 = data.get_day(1, 2)
    assert len(jan2) == 1
    assert {d['citation'] for d in jan2} == {"WCF 1.1"}

    oct19 = data.get_day(10, 19)
    assert len(oct19) == 2
    assert {d['citation'] for d in oct19} == {"WCF 25.1", "WLC 64"}

    with pytest.raises(KeyError):
        data.get_day(4, 31)
def generate_day_email(month, day, prooftexts=True):
    email = []
    for c in data.get_day(month, day):
        email.append("<h3 style='{}'>{}</h3>".format(FONT, c['long_citation']))
        if 'body' in c:
            b = re.sub(r"<a.*?footnote.*?>&bull;</a>", "&bull;", c['body'])
            email.append(b)
        else:
            email.append(c['question'])
            email.append("<br />")
            b = re.sub(r"<a.*?footnote.*?>&bull;</a>", "&bull;", c['answer'])
            email.append(b)
        if 'prooftexts' in c:
            email.append(format_prooftexts(c['prooftexts']))
    body = "\n".join(email)
    body = "<span style='{}'>{}</span>".format(FONT, body)
    return body, data.get_day_title(month, day)
Example #3
0
def test_leap_get_day():
    assert data.get_day(2, 29) == data.get_day(2, 28)