diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2009-01-18 16:03:02 -0700 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2009-01-18 16:03:02 -0700 |
commit | bae9dd7c073a8a23f71b1df0fa4cb6d90b00a337 (patch) | |
tree | b52dcec674b62492a89bf460a51e2b3432e4ad32 | |
parent | 364e05def194b80714a5ea2a3e89598db9fb4892 (diff) | |
download | freeipa-bae9dd7c073a8a23f71b1df0fa4cb6d90b00a337.tar.gz freeipa-bae9dd7c073a8a23f71b1df0fa4cb6d90b00a337.tar.xz freeipa-bae9dd7c073a8a23f71b1df0fa4cb6d90b00a337.zip |
Added example to StrEnum docstring
-rw-r--r-- | ipalib/parameters.py | 10 |
1 files changed, 10 insertions, 0 deletions
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 |