| 187 | self.gen.sample(population, k=5) |
| 188 | |
| 189 | def test_sample_on_seqsets(self): |
| 190 | class SeqSet(abc.Sequence, abc.Set): |
| 191 | def __init__(self, items): |
| 192 | self._items = items |
| 193 | |
| 194 | def __len__(self): |
| 195 | return len(self._items) |
| 196 | |
| 197 | def __getitem__(self, index): |
| 198 | return self._items[index] |
| 199 | |
| 200 | population = SeqSet([2, 4, 1, 3]) |
| 201 | with warnings.catch_warnings(): |
| 202 | warnings.simplefilter("error", DeprecationWarning) |
| 203 | self.gen.sample(population, k=2) |
| 204 | |
| 205 | def test_sample_with_counts(self): |
| 206 | sample = self.gen.sample |