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