Minor fixes

This commit is contained in:
Hynek Schlawack 2015-07-26 12:32:02 +02:00
parent 708533239d
commit 3051fbfcd3
2 changed files with 3 additions and 10 deletions

View File

@ -106,9 +106,9 @@ class _OptionalValidator(object):
def optional(validator):
"""
A validator that makes an attribute optional. An optional attribute is one
which can be set to None in addition to satisfying the requirements of the
sub-validator.
which can be set to ``None`` in addition to satisfying the requirements of
the sub-validator.
:param validator: Any other validator you wish to make optional.
:param validator: A validator that is used for non-``None`` values.
"""
return _OptionalValidator(validator)

View File

@ -128,13 +128,6 @@ class TestOptional(object):
v = optional(instance_of(int))
v(None, simple_attr("test"), None)
def test_subclass(self):
"""
Subclasses are accepted too.
"""
v = optional(instance_of(int))
v(None, simple_attr("test"), True)
def test_fail(self):
"""
Raises `TypeError` on wrong types.