<s> from datetime import date <EOL> from wtforms import Form <EOL> from wtforms . fields import DateField <EOL> from wtforms_test import FormTestCase <EOL> from tests import MultiDict <EOL> from wtforms_components import DateRange <EOL> class TestDateRangeValidator ( FormTestCase ) : <EOL> def init_form ( self , ** kwargs ) : <EOL> class ModelTestForm ( Form ) : <EOL> date = DateField ( validators = [ DateRange ( ** kwargs ) ] ) <EOL> self . form_class = ModelTestForm <EOL> return self . form_class <EOL> def test_date_greater_than_validator ( self ) : <EOL> form_class = self . init_form ( min = date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) ) <EOL> form = form_class ( MultiDict ( date = '<STR_LIT>' ) ) <EOL> form . validate ( ) <EOL> error_msg = u'<STR_LIT>' <EOL> assert form . errors [ '<STR_LIT:date>' ] == [ error_msg ] <EOL> def test_date_less_than_validator ( self ) : <EOL> form_class = self . init_form ( max = date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) ) <EOL> form = form_class ( MultiDict ( date = '<STR_LIT>' ) ) <EOL> form . validate ( ) <EOL> error_msg = u'<STR_LIT>' <EOL> assert form . errors [ '<STR_LIT:date>' ] == [ error_msg ] <EOL> def test_date_between_validator ( self ) : <EOL> form_class = self . init_form ( min = date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) , max = date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) ) <EOL> form = form_class ( MultiDict ( date = '<STR_LIT>' ) ) <EOL> form . validate ( ) <EOL> error_msg = u'<STR_LIT>' <EOL> assert form . errors [ '<STR_LIT:date>' ] == [ error_msg ] </s>
