Skip to content
Advertisement

Tag: python-hypothesis

Generating an interval set in hypothesis

I have some code that works with intervals, which are really just python dicts with the following structure: Writing a strategy for a single interval is relatively straightforward. I’d like to write a strategy to generate interval sets. An interval set is a list of intervals, such that: The list contains an arbitrary number of intervals. The interval names are

Parametrized RuleBasedStateMachine

After watching https://www.youtube.com/watch?v=zi0rHwfiX1Q I tried to port the example from C (implementation) and Erlang (testing) to Python and Hypothesis. Given this implementation (the rem function emulates %’s C behavior): and this test code The actual question is how to use Hypothesis to also parametrize over QueueMachine.cap instead of setting it manually in the test class. Answer You can set self.queue

Advertisement