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