Skip to content

Commit

Permalink
Merge pull request #364 from svisser/feature/inclusive_description
Browse files Browse the repository at this point in the history
Updated Inclusive to accept description as well
  • Loading branch information
alecthomas committed Oct 5, 2018
2 parents e72fd3b + 360d50a commit 2e68114
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions voluptuous/schema_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1121,8 +1121,9 @@ class Inclusive(Optional):
True
"""

def __init__(self, schema, group_of_inclusion, msg=None):
super(Inclusive, self).__init__(schema, msg=msg)
def __init__(self, schema, group_of_inclusion, msg=None, description=None):
super(Inclusive, self).__init__(schema, msg=msg,
description=description)
self.group_of_inclusion = group_of_inclusion


Expand Down
7 changes: 5 additions & 2 deletions voluptuous/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from nose.tools import assert_equal, assert_false, assert_raises, assert_true

from voluptuous import (
Schema, Required, Exclusive, Optional, Extra, Invalid, In, Remove, Literal,
Url, MultipleInvalid, LiteralInvalid, TypeInvalid, NotIn, Match, Email,
Schema, Required, Exclusive, Inclusive, Optional, Extra, Invalid, In, Remove,
Literal, Url, MultipleInvalid, LiteralInvalid, TypeInvalid, NotIn, Match, Email,
Replace, Range, Coerce, All, Any, Length, FqdnUrl, ALLOW_EXTRA, PREVENT_EXTRA,
validate, ExactSequence, Equal, Unordered, Number, Maybe, Datetime, Date,
Contains, Marker, IsDir, IsFile, PathExists, SomeOf, TooManyValid, Self,
Expand Down Expand Up @@ -1035,6 +1035,9 @@ def test_description():
exclusive = Exclusive('alpha', 'angles', description='Hello')
assert exclusive.description == 'Hello'

inclusive = Inclusive('alpha', 'angles', description='Hello')
assert inclusive.description == 'Hello'

required = Required('key', description='Hello')
assert required.description == 'Hello'

Expand Down

0 comments on commit 2e68114

Please sign in to comment.