Ejemplo n.º 1
0
def test_neq():
    outcome1 = Outcome('education', 30, 30, effect_size=0.1, variance=1.0)
    outcome2 = Outcome('education', 20, 25, effect_size=0.2, variance=2.0)
    outcome3 = Outcome('crime', 30, 30, effect_size=0.1, variance=1.0)
    outcome4 = Outcome('education', 30, 30, effect_size=0.1, variance=1.0)
    assert outcome1 != outcome2
    assert outcome1 != outcome3
    assert not outcome1 != outcome4
Ejemplo n.º 2
0
def test_init():
    wheel_1 = Wheel()
    outcome_1 = Outcome("Split-Bet", 17)
    outcome_2 = Outcome("Split-Bet", 1)
    outcome_3 = Outcome("Any Craps", 8)
    bin_1 = Bin([Outcome("0", 35), outcome_2, outcome_3])
    bin_2 = Bin([Outcome("Straight-Bet", 12)])
    assert outcome_1 == outcome_2
    assert outcome_2 in bin_1 and outcome_3 in bin_1
Ejemplo n.º 3
0
def test_add():
    outcome1 = Outcome('education', 30, 30, effect_size=0.1, variance=1.0)
    outcome2 = Outcome('education', 20, 25, effect_size=0.2, variance=2.0)
    outcome3 = outcome1 + outcome2
    assert outcome3.label == 'education'
    assert outcome3.effect_size == (0.1 * (1 / 1.0) + 0.2 *
                                    (1 / 2.0)) / (1.0 + 2.0)
    assert outcome3.variance == 3.0
    assert outcome3.treat_n == 50
    assert outcome3.control_n == 55
Ejemplo n.º 4
0
def test_add_bins_to_wheel():
    wheel_1 = Wheel()
    outcome_1 = Outcome("Split-Bet", 17)
    outcome_2 = Outcome("Split-Bet", 1)
    outcome_3 = Outcome("Any Craps", 8)
    bin_1 = Bin([Outcome("0", 35), outcome_2, outcome_3])
    bin_2 = Bin([Outcome("Straight-Bet", 12)])
    wheel_1.addOutcomes(1, bin_1)
    wheel_1.addOutcomes(2, bin_2)
    assert bin_1 in wheel_1.bins[0]
Ejemplo n.º 5
0
def test_init():
    outcome1 = Outcome('education', 30, 30, effect_size=0.1, variance=1.0)
    outcome2 = Outcome('education', 20, 25, effect_size=0.2, variance=2.0)

    assert isinstance(outcome1.id, int)
    assert isinstance(outcome2.id, int)
    assert outcome1.id != outcome2.id
    assert outcome2.id > outcome1.id

    outcome1 = Outcome('education', 40, 30, effect_size=0.1, variance=1.0)
    assert outcome1.id != outcome2.id
    assert outcome2.id < outcome1.id
Ejemplo n.º 6
0
def test_init_shared():
    outcome_1 = Outcome("00-0-1-2-3", 6)
    outcome_2 = Outcome("Split-Bet", 17)
    outcome_3 = Outcome("Any Craps", 8)
    outcome_4 = Outcome("Split-Bet", 1)
    bin_1 = Bin([Outcome("0", 35), outcome_2, outcome_3])
    bin_2 = Bin([Outcome("Straight-Bet", 12)])
    assert outcome_2 in bin_1 and outcome_3 in bin_1
    assert outcome_2 == outcome_4
Ejemplo n.º 7
0
def test_str():
    outcome = Outcome('education', 30, 30, effect_size=0.1, variance=1.0)
    assert str(
        outcome
    ) == f'id={outcome.id}, Outcome=education, Method=custom, ES={0.1:.4f}, Variance={1.0:.4f}'