Random sampling with Hypothesis
<p>In Hypothesis, there is an <a href="http://hypothesis.readthedocs.io/en/latest/data.html#choices" rel="nofollow">corresponding <code>sampled_from()</code> strategy</a> to <a href="https://docs.python.org/3/library/random.html#random.choice" rel="nofollow"><code>random.choice()</code></a>:</p>

<pre><code>In [1]: from hypothesis import find, strategies as st

In [2]: find(st.sampled_from(('ST', 'LT', 'TG', 'CT')), lambda x: True)
Out[2]: 'ST'
</code></pre>

<p>But, is there a way to have <a href="https://docs.python.org/3/library/random.html#random.sample" rel="nofollow"><code>random.sample()</code></a>-like strategy to produce subsequences of length N out of a sequence?</p>

<pre><code>In [3]: import random

In [4]: random.sample(('ST', 'LT', 'TG', 'CT'), 2)
Out[4]: ['CT', 'TG']
</code></pre>

<p>You could do:</p>

<pre><code>permutations(elements).map(lambda x: x[:n])
</code></pre>

python unit-testing testing random python-hypothesis