16 changes: 10 additions & 6 deletions tests/nocover/test_example_quality.py
Expand Up @@ -22,7 +22,11 @@
import operator
from decimal import Decimal
from fractions import Fraction
from collections import Counter, OrderedDict
try:
from collections import Counter, OrderedDict
except ImportError:
from counter import Counter
from ordereddict import OrderedDict

import pytest
from hypothesis import Settings, assume
Expand Down Expand Up @@ -107,7 +111,7 @@ def test_minimize_one_of():

def test_minimize_mixed_list():
mixed = minimal(lists(integers() | text()), lambda x: len(x) >= 10)
assert set(mixed).issubset({0, ''})
assert set(mixed).issubset(set((0, '')))


def test_minimize_longer_string():
Expand All @@ -120,15 +124,15 @@ def test_minimize_longer_list_of_strings():

def test_minimize_3_set():
assert minimal(sets(integers()), lambda x: len(x) >= 3) in (
{0, 1, 2},
{-1, 0, 1},
set((0, 1, 2)),
set((-1, 0, 1)),
)


def test_minimize_3_set_of_tuples():
assert minimal(
sets(tuples(integers())),
lambda x: len(x) >= 2) == {(0,), (1,)}
lambda x: len(x) >= 2) == set(((0,), (1,)))


def test_minimize_sets_of_sets():
Expand Down Expand Up @@ -251,7 +255,7 @@ def test_dictionary(dict_class):
dictionaries(keys=integers(), values=text(), dict_class=dict_class),
lambda t: len(t) >= 3)
assert isinstance(x, dict_class)
assert set(x.values()) == {''}
assert set(x.values()) == set(('',))
for k in x:
if k < 0:
assert k + 1 in x
Expand Down
30 changes: 29 additions & 1 deletion tests/nocover/test_statistical_distribution.py
Expand Up @@ -30,7 +30,10 @@
import re
import math
import random
from collections import Counter
try:
from collections import Counter
except ImportError:
from counter import Counter

import pytest
import hypothesis.internal.reflection as reflection
Expand All @@ -49,6 +52,31 @@
MAX_RUNS = MIN_RUNS * 20


if not hasattr(math, 'erf'):
def erf(x):
# constants
a1 = 0.254829592
a2 = -0.284496736
a3 = 1.421413741
a4 = -1.453152027
a5 = 1.061405429
p = 0.3275911

# Save the sign of x
sign = 1
if x < 0:
sign = -1
x = abs(x)

# A & S 7.1.26
t = 1.0/(1.0 + p*x)
y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*math.exp(-x*x)

return sign*y

math.erf = erf


def cumulative_normal(x):
return 0.5 * (1 + math.erf(x / math.sqrt(2)))

Expand Down