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 contain…
Tag: python-hypothesis
Hypothesis library: strategy for the complement of some other strategy
I’m using the Hypothesis library for unit testing. With this library you don’t hand-pick inputs, but you define the complete set of inputs for which you want to test. Hypothesis will then sample from this set to look for inputs that break the function. This is also known as property-based testing.…
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 para…
Is there a way to specify multiple columns of a dataframe with different strategies in Hypothesis?
I would like to create a dataframe for testing that looks like: target var0 var1 var2 var3 0 0.34 1.43 0.41 0.98 1 -1.43 -0.31 7.43 1.95 I have been able to do this by defining the columns as a dictionary as seen in this answer https://stackoverflow.com/a/65720110/251754, but I’m wondering if there is a…