Exemplo n.º 1
0
def test_get_sign_by_date(signs):
    # This should work but the code has a bug the makes this fail.
    #
    # ('Capricorn', 'December 22', 'January 19'),
    tests = [('Aries', 'March 21', 'April 19'),
             ('Taurus', 'April 20', 'May 20'), ('Gemini', 'May 21', 'June 20'),
             ('Cancer', 'June 21', 'July 22'), ('Leo', 'July 23', 'August 22'),
             ('Virgo', 'August 23', 'September 22'),
             ('Libra', 'September 23', 'October 22'),
             ('Scorpio', 'October 23', 'November 21'),
             ('Sagittarius', 'November 22', 'December 21'),
             ('Aquarius', 'January 20', 'February 18'),
             ('Pisces', 'February 19', 'March 20')]
    one_day = timedelta(days=1)
    for (sign, date1, date2) in tests:
        date1 = datetime.strptime(date1, '%B %d')
        date2 = datetime.strptime(date2, '%B %d')
        date3 = date1 + one_day
        assert (get_sign_by_date(signs, date1) == sign)
        assert (get_sign_by_date(signs, date2) == sign)
        assert (get_sign_by_date(signs, date3) == sign)
Exemplo n.º 2
0
def test_get_sign_by_date(signs):
    date1 = datetime(2019, 2, 22)
    date2 = datetime(2019, 12, 31)
    assert get_sign_by_date(signs, date1) == "Pisces"
    assert get_sign_by_date(signs, date2) == "Capricorn"
Exemplo n.º 3
0
def test_get_sign_by_date_negative_tests(signs, arg, expected):
    assert not get_sign_by_date(signs, arg) == expected
Exemplo n.º 4
0
def test_get_sign_by_date(signs, arg, expected):
    assert get_sign_by_date(signs, arg) == expected
Exemplo n.º 5
0
def test_get_sign_by_date(signs, date, expected):
    assert get_sign_by_date(signs, date) == expected
def test_get_sign_by_date(signs, dt, result):
    m, d = dt
    assert get_sign_by_date(signs, datetime(year=2000, month=m, day=d)) == result
Exemplo n.º 7
0
def test_sign_by_date(signs, date, sign):
    assert get_sign_by_date(signs, date) == sign