Example #1
0
def test_timestamp_min():
    v = val.Timestamp(min=datetime.datetime(2010, 1, 1))
    assert v.is_valid(datetime.datetime(2010, 1, 1))
    assert v.is_valid(datetime.datetime(2011, 2, 2))
    assert not v.is_valid(datetime.datetime(2009, 12, 31))
Example #2
0
def test_timestamp_max():
    v = val.Timestamp(max=datetime.datetime(2010, 1, 1))
    assert v.is_valid(datetime.datetime(2010, 1, 1))
    assert v.is_valid(datetime.datetime(2009, 2, 2))
    assert not v.is_valid(datetime.datetime(2010, 2, 2))
Example #3
0
def test_datetime():
    v = val.Timestamp()
    assert v.is_valid(datetime(2015, 1, 1, 1))
    assert not v.is_valid(date(2015, 1, 1))
    assert not v.is_valid('')
    assert not v.is_valid(0)