Пример #1
0
def parse_one_ymd(target, t):
    """
    test parse_ymd for one day
    """
    n = time.localtime()
    d = wr.week_diff(n[6], wr.day_offset(t))
    s = wr.stringify(time.localtime(wr.day_plus(d)))
    assert wr.parse_ymd(target) == s[0:3]
Пример #2
0
def test_parse_ymd():
    """
    test parse_ymd() for each weekday, yesterday, and tomorrow
    """
    pytest.debug_func()
    s = wr.stringify(time.localtime(wr.day_plus(-1)))
    assert wr.parse_ymd('yesterday') == s[0:3]
    s = wr.stringify(time.localtime(wr.day_plus(1)))
    assert wr.parse_ymd('tomorrow') == s[0:3]

    parse_one_ymd('monday', 'M')
    parse_one_ymd('tuesday', 'T')
    parse_one_ymd('wednesday', 'W')
    parse_one_ymd('thursday', 't')
    parse_one_ymd('friday', 'F')
    parse_one_ymd('saturday', 's')
    parse_one_ymd('sunday', 'S')