예제 #1
0
def test_before_dt_format():
    with pytest.raises(ValidationError) as e:
        before(datetime(2015, 1, 1, 0, 0, 0), dt_format='%Y-%m-%d')(datetime(2015, 1, 2, 0, 0, 0))

    assert e.value.message == 'Value is after 2015-01-01.'
예제 #2
0
def test_before_greater_than():
    with pytest.raises(ValidationError):
        before(datetime(2015, 1, 1, 0, 0, 0))(datetime(2015, 1, 1, 0, 0, 1))
예제 #3
0
def test_before_equal():
    before(datetime(2015, 1, 1, 0, 0, 0))(datetime(2015, 1, 1, 0, 0, 0))
예제 #4
0
def test_before_less_than():
    before(datetime(2015, 1, 1, 0, 0, 0))(datetime(2014, 12, 31, 23, 59, 59))
예제 #5
0
def test_before_datetime_date():
    before(datetime(2015, 1, 1, 0, 0, 0))(date(2014, 12, 31))
예제 #6
0
def test_before_date_datetime():
    before(date(2015, 1, 1))(datetime(2014, 12, 31, 23, 59, 59))