Skip to content

State contract. #49

@proofit404

Description

@proofit404

Declarative context values validation.

Applies gradually as context fills in.

from stories import story, arguments

class Action:
    @story 
    @arguments("foo")
    def do(I):
        pass

Action.do.contract({
    "foo": lambda value: (None, 'integer required')
})
>>> Action().do(foo='5')
ContextContractError: foo variable is invalid (integer required)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions