Skip to content

Commit

Permalink
test: add more tests for individual strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
hollandjg committed Jan 19, 2024
1 parent 05c7b60 commit 42ab469
Showing 1 changed file with 41 additions and 3 deletions.
44 changes: 41 additions & 3 deletions tests/test_strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ def variable_boolean_strategy(draw, name=None, label=None, units=None, covariate
)


@given(variable_boolean_strategy())
def test_variable_boolean_strategy_creation(o):
assert o


@st.composite
def variable_integer_strategy(draw, name=None, label=None, units=None, covariate=None):
name, label, units, covariate = draw(
Expand All @@ -84,9 +89,7 @@ def variable_integer_strategy(draw, name=None, label=None, units=None, covariate
value_range = draw(
st.one_of(
st.none(),
st.tuples(st.integers(), st.integers())
.filter(lambda x: x[0] != x[1])
.map(sorted),
st.tuples(st.integers(), st.integers()).map(sorted),
)
)
if value_range is None:
Expand All @@ -113,6 +116,11 @@ def variable_integer_strategy(draw, name=None, label=None, units=None, covariate
)


@given(variable_integer_strategy())
def test_variable_integer_strategy_creation(o):
assert o


@st.composite
def variable_real_strategy(draw, name=None, label=None, units=None, covariate=None):
name, label, units, covariate = draw(
Expand Down Expand Up @@ -148,6 +156,11 @@ def variable_real_strategy(draw, name=None, label=None, units=None, covariate=No
)


@given(variable_real_strategy())
def test_variable_real_strategy_creation(o):
assert o


@st.composite
def variable_probability_strategy(
draw, name=None, label=None, units=None, covariate=None
Expand All @@ -173,6 +186,11 @@ def variable_probability_strategy(
)


@given(variable_probability_strategy())
def test_variable_probability_strategy_creation(o):
assert o


@st.composite
def variable_probability_sample_strategy(
draw, name=None, label=None, units=None, covariate=None
Expand All @@ -198,6 +216,11 @@ def variable_probability_sample_strategy(
)


@given(variable_probability_sample_strategy())
def test_variable_probability_sample_strategy_creation(o):
assert o


@st.composite
def variable_probability_distribution_strategy(
draw, name=None, label=None, units=None, covariate=None
Expand All @@ -223,6 +246,11 @@ def variable_probability_distribution_strategy(
)


@given(variable_probability_distribution_strategy())
def test_variable_probability_distribution_strategy_creation(o):
assert o


@st.composite
def variable_sigmoid_strategy(draw, name=None, label=None, units=None, covariate=None):
name, label, units, covariate = draw(
Expand All @@ -246,6 +274,11 @@ def variable_sigmoid_strategy(draw, name=None, label=None, units=None, covariate
)


@given(variable_sigmoid_strategy())
def test_variable_sigmoid_strategy_creation(o):
assert o


@st.composite
def variable_class_strategy(draw, name=None, label=None, units=None, covariate=None):
name, label, units, covariate = draw(
Expand All @@ -269,6 +302,11 @@ def variable_class_strategy(draw, name=None, label=None, units=None, covariate=N
)


@given(variable_class_strategy())
def test_variable_class_strategy_creation(o):
assert o


VARIABLE_STRATEGIES = (
variable_boolean_strategy,
variable_integer_strategy,
Expand Down

0 comments on commit 42ab469

Please sign in to comment.