Clarify instance_of validator also takes tuples
This commit is contained in:
parent
694598a36d
commit
402b825539
|
@ -35,13 +35,13 @@ def instance_of(type):
|
||||||
"""
|
"""
|
||||||
A validator that raises a :exc:`TypeError` if the initializer is called
|
A validator that raises a :exc:`TypeError` if the initializer is called
|
||||||
with a wrong type for this particular attribute (checks are perfomed using
|
with a wrong type for this particular attribute (checks are perfomed using
|
||||||
:func:`isinstance`).
|
:func:`isinstance` therefore it's also valid to pass a tuple of types).
|
||||||
|
|
||||||
:param type: The type to check for.
|
:param type: The type to check for.
|
||||||
:type type: type
|
:type type: type or tuple of types
|
||||||
|
|
||||||
The :exc:`TypeError` is raised with a human readable error message, the
|
The :exc:`TypeError` is raised with a human readable error message, the
|
||||||
attribute (of type :class:`attr.Attribute`), the expected type and the
|
attribute (of type :class:`attr.Attribute`), the expected type, and the
|
||||||
value it got.
|
value it got.
|
||||||
"""
|
"""
|
||||||
return _InstanceOfValidator(type)
|
return _InstanceOfValidator(type)
|
||||||
|
|
Loading…
Reference in New Issue