Пример #1
0
 def test_daterange_datetime(self):
     from occams_datastore import models as datastore
     from occams_forms.renderers import make_field
     import wtforms
     from wtforms_components import DateRange
     attribute = datastore.Attribute(
         name=u'daterange_test', title=u'daterange_test', type='datetime')
     field = make_field(attribute)
     field = field.bind(wtforms.Form(), attribute.name)
     assert any(isinstance(v, DateRange) for v in field.validators)
Пример #2
0
 def test_string_min_max_same_value(self):
     from occams_datastore import models as datastore
     from occams_forms.renderers import make_field
     import wtforms
     from wtforms.validators import Length
     attribute = datastore.Attribute(
         name=u'string_test', title=u'string_test', type='string',
         value_min=3, value_max=3)
     field = make_field(attribute)
     field = field.bind(wtforms.Form(), attribute.name)
     assert any(isinstance(v, Length) for v in field.validators)
Пример #3
0
 def test_number_min_max_same_number(self):
     from occams_datastore import models as datastore
     from occams_forms.renderers import make_field
     import wtforms
     from wtforms.validators import NumberRange
     attribute = datastore.Attribute(
         name=u'number_test', title=u'number_test', type='number',
         value_min=3, value_max=3)
     field = make_field(attribute)
     field = field.bind(wtforms.Form(), attribute.name)
     assert any(isinstance(v, NumberRange) for v in field.validators)
Пример #4
0
 def test_multiple_choice_min_max(self):
     from occams_datastore import models as datastore
     from occams_forms.renderers import make_field
     import wtforms
     from wtforms.validators import Length
     attribute = datastore.Attribute(
         name=u'choice', title=u'choice_test', type='choice',
         is_collection=True,
         value_min=1, value_max=12)
     field = make_field(attribute)
     field = field.bind(wtforms.Form(), attribute.name)
     assert any(isinstance(v, Length) for v in field.validators)