Added example to StrEnum docstring

This commit is contained in:
Jason Gerard DeRose 2009-01-18 16:03:02 -07:00
parent 364e05def1
commit bae9dd7c07

View File

@ -934,6 +934,16 @@ class BytesEnum(Enum):
class StrEnum(Enum):
"""
Enumerable for Unicode text (stored in the ``unicode`` type).
For example:
>>> enum = StrEnum('my_enum', values=(u'One', u'Two', u'Three'))
>>> enum.validate(u'Two') is None
True
>>> enum.validate(u'Four')
Traceback (most recent call last):
...
ValidationError: invalid 'my_enum': must be one of (u'One', u'Two', u'Three')
"""
type = unicode