Created
October 10, 2016 20:13
-
-
Save Tinche/e1339718ff9d5b56e1c50773f3a7a8a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from hypothesis.stateful import RuleBasedStateMachine, run_state_machine_as_test, rule, precondition | |
| def test_t(): | |
| class StatefulTest(RuleBasedStateMachine): | |
| def __init__(self): | |
| print("init") | |
| super().__init__() | |
| self.a = False | |
| self.b = False | |
| self.c = False | |
| @rule() | |
| def open_a(self): | |
| self.a = True | |
| @rule() | |
| @precondition(lambda self: self.a) | |
| def open_b(self): | |
| self.b = True | |
| @rule() | |
| @precondition(lambda self: self.b) | |
| def open_c(self): | |
| self.c = True | |
| @rule() | |
| @precondition(lambda self: self.c) | |
| def final(self): | |
| pass | |
| run_state_machine_as_test(StatefulTest) | |
| test_t.is_hypothesis_test = True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment