DOC: Clarify expect_bounded docstring.

This commit is contained in:
Scott Sanderson
2016-09-02 13:33:55 -04:00
parent 12101c55c8
commit b0a93d57a0
+7 -7
View File
@@ -505,8 +505,13 @@ def expect_element(*_pos, **named):
def expect_bounded(**named):
"""
Preprocessing decorator that verifies inputs fall between upper and lower
bounds.
Preprocessing decorator verifying that inputs fall between bounds.
Bounds should be passed as a pair of ``(min_value, max_value)``. Both
bounds are checked inclusively.
``None`` may be passed as ``min_value`` or ``max_value`` to signify that
the input is only bounded above or below.
Usage
-----
@@ -524,11 +529,6 @@ def expect_bounded(**named):
ValueError: ...foo() expected a value between 1 and 5 for argument 'x',
but got 6 instead.
Notes
-----
None can be passed as the lower or upper bound to signify that a value only
has an upper or lower bound.
>>> @expect_bounded(x=(2, None))
... def foo(x):
... return x