File: test_integer_field.py

package info (click to toggle)
wtforms-components 0.11.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 352 kB
  • sloc: python: 1,582; makefile: 135; sh: 11
file content (16 lines) | stat: -rw-r--r-- 544 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from wtforms.validators import NumberRange

from tests import FieldTestCase, MultiDict
from wtforms_components import IntegerField


class TestIntegerField(FieldTestCase):
    field_class = IntegerField

    def test_assigns_min_and_max(self):
        form_class = self.init_form(validators=[NumberRange(min=2, max=10)])
        form = form_class(MultiDict(test_field=3))
        assert str(form.test_field) == (
            '<input id="test_field" max="10" min="2" '
            'name="test_field" step="1" type="number" value="3">'
        )