Пример #1
0
def test_day_min():
    v = val.Day(min=datetime.date(2010, 1, 1))
    assert v.is_valid(datetime.date(2010, 1, 1))
    assert v.is_valid(datetime.date(2011, 2, 2))
    assert not v.is_valid(datetime.date(2009, 12, 31))
Пример #2
0
def test_day_max():
    v = val.Day(max=datetime.date(2010, 1, 1))
    assert v.is_valid(datetime.date(2010, 1, 1))
    assert v.is_valid(datetime.date(2009, 2, 2))
    assert not v.is_valid(datetime.date(2010, 2, 2))
Пример #3
0
def test_date():
    v = val.Day()
    assert v.is_valid(date(2015, 1, 1))
    assert v.is_valid(datetime(2015, 1, 1, 1))
    assert not v.is_valid('')
    assert not v.is_valid(0)