Exemplo n.º 1
0
def test_combinations_invert_n_m(two_ints):
    """
    nCm = nCn-m
    n!/(n-m)!m! = n!/m!(n-m)!
    """
    num = two_ints[0]
    choose = two_ints[1]

    n_choose_m = stats.combinations(num, choose=choose)
    n_choose_n_minus_m = stats.combinations(num, choose=num - choose)

    assert n_choose_m == n_choose_n_minus_m
Exemplo n.º 2
0
def test_combinations_versus_reference_implementation(two_ints):
    num = two_ints[0]
    choose = two_ints[1]

    result = stats.combinations(num, choose=choose)
    reference = stats._combinations_reference(num, choose=choose)
    assert result == reference
Exemplo n.º 3
0
def test_combinations_choose_one(integer):
    assert stats.combinations(integer, choose=1) == integer
Exemplo n.º 4
0
def test_combinations_choose_zero(integer):
    assert stats.combinations(integer, choose=0) == 1
Exemplo n.º 5
0
def test_combinations_choose_all(integer):
    assert stats.combinations(integer, choose=integer) == 1
Exemplo n.º 6
0
def test_combinations_choose_none(integer):
    assert stats.combinations(integer) == 1