Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ python:
- '3.5'
- '3.6'
install:
- pip install mypy
- pip install coveralls
- pip install pycodestyle
- pip install --upgrade .
script:
- mypy --ignore-missing-imports houston
- pycodestyle houston
- pytest test
- coverage run --source=houston setup.py test
Expand Down
14 changes: 9 additions & 5 deletions houston/predicate.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
__all__ = ['Predicate']
__all__ = ['Predicate', 'Invariant', 'Postcondition', 'Precondition']

from typing import Callable

import attr

from .action import Action
from .state import State
from .environment import Environment


@attr.s(frozen=True)
class Predicate(object):
Expand All @@ -13,13 +17,13 @@ class Predicate(object):
of purposes.
"""
name = attr.ib(type=str)
predicate = attr.ib(type=Callable[['Action', 'State', 'Environment'],
predicate = attr.ib(type=Callable[[Action, State, Environment],
bool])

def check(self,
action: 'Action',
state: 'State',
environment: 'Environment'
action: Action,
state: State,
environment: Environment
) -> bool:
"""
Determines whether this predicate is satisfied by a given action,
Expand Down