mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-30 05:39:30 +08:00
DOC: Clarify expect_bounded docstring.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user