From bae9dd7c073a8a23f71b1df0fa4cb6d90b00a337 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Sun, 18 Jan 2009 16:03:02 -0700 Subject: [PATCH] Added example to StrEnum docstring --- ipalib/parameters.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ipalib/parameters.py b/ipalib/parameters.py index 0d764d60a..7cc93e905 100644 --- a/ipalib/parameters.py +++ b/ipalib/parameters.py @@ -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