title: generating conditional data with Hypothesis Python
body: <p>I want to generate a list of lists of integers of size 2 with the following conditions. </p>
  
  <ul>
  <li>the first element should be smaller than the second and </li>
  <li>all the data should be unique.</li>
  </ul>
  
  <p>I could generate each tuple with a custom function but don't know how to use that to satisfy the second condition.</p>
  
  <pre><code>from hypothesis import strategies as st
  
  @st.composite
  def generate_data(draw):
      min_val, max_val = draw(st.lists(st.integers(1, 1e2), min_size=2, max_size=2))
      st.assume(min_val &lt; max_val)
      return [min_val, max_val]
  </code></pre>
  
  <p>I could generate the data by iterating over <code>generate_date</code> a few times in this (inefficient ?) way:</p>
  
  <pre><code>&gt;&gt;&gt; [generate_data().example() for _ in range(3)]
      [[5, 31], [1, 12], [33, 87]]
  </code></pre>
  
  <p>But how can I check that the data is unique? </p>
  
  <p>E.g, the following values are invalid:</p>
  
  <pre><code>[[1, 2], [1, 5], ...]  # (1 is repeated)
  [[1, 2], [1, 2], ...]  # (repeated data)
  </code></pre>
  
  <p>but the following is valid:</p>
  
  <pre><code>[[1, 2], [3, 4], ...]
  </code></pre>