How to use the deal.ensure function in deal

To help you get started, we’ve selected a few deal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github life4 / deal / tests / test_decorators / test_ensure.py View on Github external
    @deal.ensure(lambda a, b, result: a > 0 and b > 0 and result != 'same number')
    def func(a, b):
        if a == b:
            return 'same number'
        else:
            return 'different numbers'
github life4 / deal / tests.py View on Github external
        @deal.ensure(lambda a, b, result: a > 0 and b > 0 and result != 'same number')
        def func(a, b):
            if a == b:
                return 'same number'
            else:
                return 'different numbers'
github life4 / deal / tests / test_decorators / test_ensure.py View on Github external
    @deal.ensure(lambda a, b, result: a > 0 and b > 0 and result != 'same number')
    async def func(a, b):
        if a == b:
            return 'same number'
        else:
            return 'different numbers'
github life4 / deal / tests / test_aliases.py View on Github external
    @deal.ensure(lambda *args, **kwargs: True)
    @deal.raises(ValueError)
    @deal.offline()
    @deal.offline
    @deal.safe
    @deal.safe()
    @deal.silent
    @deal.silent()
    @deal.pure
    @deal.chain(deal.safe, deal.silent)
    def func(x: int) -> int:
        """docs were before docker
        """
        return x
github life4 / deal / tests / test_decorators / test_ensure.py View on Github external
    @deal.ensure(lambda x, y, result: result > y ** 2)
    def multiply(x, y):
        yield x * y
        yield x * y * 2
        yield x * y * 4
github life4 / deal / examples / concat.py View on Github external
@deal.ensure(lambda _: _.result.endswith(_.right))
@deal.has()
def concat(left: str, right: str) -> str:
    return left + right