Skip to content
Snippets Groups Projects
Commit 783504b4 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

minor changes in `satella.coding.decorators.preconditions`

parent 2e6983e5
No related branches found
No related tags found
No related merge requests found
__version__ = '2.14.17_a4'
__version__ = '2.14.17_a5'
......@@ -4,6 +4,7 @@ import typing as tp
from satella.coding.typing import T, Predicate
from satella.exceptions import PreconditionError
from .decorators import wraps
from .arguments import for_argument
from ..misc import source_to_function
Expression = tp.NewType('Expression', str)
......@@ -89,6 +90,7 @@ def precondition(*t_ops: Condition, **kw_opts: Condition):
return outer
@for_argument(source_to_function)
def postcondition(condition: Condition):
"""
Return a decorator, asserting that result of this function, called with provided
......@@ -98,8 +100,6 @@ def postcondition(condition: Condition):
:param condition: callable that accepts a single argument, the return value of the function.
Can be also a string, in which case it is an expression about the value x of return
"""
condition = source_to_function(condition)
def outer(fun):
@wraps(fun)
def inner(*args, **kwargs):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment