def test_max(self): field = Integer(max=3) field.data = field.convert(["4"]) assert field.data == 4 assert not field.validate() assert field.errors == ["Must be at most 3."]
def test_min(self): field = Integer(min=5) field.data = field.convert(["4"]) assert field.data == 4 assert not field.validate() assert field.errors == ["Must be at least 5."]
def test_none_required(self): field = Integer() field.data = field.convert(None) assert field.data is None assert not field.validate() assert field.errors == ["Required."]
def test_none_default(self): field = Integer(default=4) field.data = field.convert(None) assert field.data == 4 assert field.validate() assert field.errors == []
def test_none(self): field = Integer(required=False) field.data = field.convert(None) assert field.data is None assert field.validate() assert field.errors == []
def test_basic(self): field = Integer() field.data = field.convert(["4"]) assert field.data == 4 assert field.validate() assert field.errors == []