Skip to content

Commit

Permalink
Support sampling from enums
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed May 14, 2017
1 parent b4a635c commit 0f9081e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ information to the contrary.


------------------
3.8.4 - 2017-05-12
3.8.4 - 2017-05-14
------------------

This is a compatibility bugfix release. ``sampled_from`` no longer raises
a deprecation warning when sampling from an ``Enum``, as all enums have a
reliable iteration order.

Instead of unconditionally importing ``sqlite3``, Hypothesis now imports it
when a SQLite database is first used. This was the major blocker for BSD
support with default settings.
Expand Down
3 changes: 2 additions & 1 deletion src/hypothesis/internal/conjecture/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

from __future__ import division, print_function, absolute_import

import enum
import math
from collections import Sequence

Expand Down Expand Up @@ -104,7 +105,7 @@ def centered_integer_range(data, lower, upper, center):


def check_sample(values):
if not isinstance(values, Sequence):
if not isinstance(values, (Sequence, enum.EnumMeta)):
note_deprecation(
('Cannot sample from %r, not a sequence. ' % (values,)) +
'Hypothesis goes to some length to ensure that sampling an '
Expand Down

0 comments on commit 0f9081e

Please sign in to comment.