1
0
Fork 0
mirror of https://github.com/yweber/lodel2.git synced 2025-10-21 00:29:03 +02:00

Added unit tests for the Regex datahandler

This commit is contained in:
Roland Haroutiounian 2016-08-17 17:22:59 +02:00
commit 9ab3293538

View file

@ -2,6 +2,7 @@
import warnings
import inspect
from lodel.leapi.datahandlers.datas_base import *
import re
##@brief Data field designed to handle formated strings
class FormatString(Varchar):
@ -46,7 +47,7 @@ max_length and regex'
def _check_data_value(self, value):
error = None
if not self.compiled_re.match(value):
if not self.compiled_re.match(value) or len(value) > self.max_length:
value = ''
msg = '"%s" doesn\'t match the regex "%s"' % (value, self.regex)
error = TypeError(msg)