Modify UUID checking
parent
cd815bfe84
commit
c5ba5dad65
|
@ -149,9 +149,9 @@ class IDProperty(Property):
|
|||
if not value.startswith(self.required_prefix):
|
||||
raise ValueError("must start with '{0}'.".format(self.required_prefix))
|
||||
try:
|
||||
uuid.UUID(value.split('--', 1)[1], version=4)
|
||||
uuid.UUID(value.split('--', 1)[1])
|
||||
except Exception:
|
||||
raise ValueError("must have a valid version 4 UUID after the prefix.")
|
||||
raise ValueError("must have a valid UUID after the prefix.")
|
||||
return value
|
||||
|
||||
def default(self):
|
||||
|
|
|
@ -86,7 +86,7 @@ def test_id_property():
|
|||
assert str(excinfo.value) == "must start with 'my-type--'."
|
||||
with pytest.raises(ValueError) as excinfo:
|
||||
idprop.clean('my-type--foo')
|
||||
assert str(excinfo.value) == "must have a valid version 4 UUID after the prefix."
|
||||
assert str(excinfo.value) == "must have a valid UUID after the prefix."
|
||||
|
||||
assert idprop.clean(idprop.default())
|
||||
|
||||
|
|
Loading…
Reference in New Issue