From 42ab469f9131cc3ac4fea5bf2e1eb34c0c5b42ff Mon Sep 17 00:00:00 2001 From: John Gerrard Holland Date: Fri, 19 Jan 2024 16:54:32 -0500 Subject: [PATCH] test: add more tests for individual strategies --- tests/test_strategies.py | 44 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/tests/test_strategies.py b/tests/test_strategies.py index 29f8e1d7..06241dfc 100644 --- a/tests/test_strategies.py +++ b/tests/test_strategies.py @@ -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( @@ -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: @@ -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( @@ -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 @@ -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 @@ -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 @@ -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( @@ -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( @@ -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,