def test_constraint_contains(): lcs = LineupConstraints() lcs.add_group_constraint(['A', 'B'], 1) lcs.ban(['C']) lcs.add_group_constraint(['E', 'F', 'G'], (1, 3)) lcs.lock(['H']) for c in ['A', 'B', 'C', 'E', 'F', 'G', 'H']: ntools.assert_equal(c in lcs, True)
def test_build_constraint_set(): lcs = LineupConstraints() lcs.add_group_constraint(['Spencer Ware', 'Amari Cooper'], 1) lcs.ban(['Packers']) lcs.add_group_constraint(['Eli Manning', 'Russell Wilson', 'Doug Martin'], (1, 3)) lcs.lock(['Will Fuller']) ntools.assert_equal(len(lcs), 4)
def test_bad_group_duplicate_bounds(): lcs = LineupConstraints() lcs.add_group_constraint(['Spencer Ware', 'Amari Cooper'], (1, 1))
def test_bad_group_shadow_ban_hi_lo_bound(): lcs = LineupConstraints() lcs.add_group_constraint(['Spencer Ware', 'Amari Cooper'], (0, 0))
def test_dup_group_rule2(): lcs = LineupConstraints() lcs.add_group_constraint(['Eli Manning', 'Russell Wilson', 'Doug Martin'], (1, 2)) lcs.add_group_constraint(['Eli Manning', 'Russell Wilson', 'Doug Martin'], (1, 2))
def test_dup_group_rule(): lcs = LineupConstraints() lcs.add_group_constraint(['Spencer Ware', 'Amari Cooper'], 1) lcs.add_group_constraint(['Spencer Ware', 'Amari Cooper'], 1)
def test_group_ban_conflict(): lcs = LineupConstraints() lcs.add_group_constraint(['Eli Manning', 'Doug Martin'], (1, 2)) lcs.ban(['Eli Manning'])
def test_empty_group(): lcs = LineupConstraints() lcs.add_group_constraint([], 1)
def test_single_player_group(): lcs = LineupConstraints() lcs.add_group_constraint(['Spencer Ware'], 1)
def test_bad_group_too_many_bounds(): lcs = LineupConstraints() lcs.add_group_constraint(['Spencer Ware', 'Amari Cooper'], (1, 1, 2))
def test_bad_group_bounds_type(): lcs = LineupConstraints() lcs.add_group_constraint(['Spencer Ware', 'Amari Cooper'], '1')
def test_bad_group_dup_player(): lcs = LineupConstraints() lcs.add_group_constraint(['Amari Cooper', 'Amari Cooper'], 1)
def test_bad_group_max_set(): lcs = LineupConstraints() lcs.add_group_constraint(['Spencer Ware', 'Amari Cooper'], (1, 3))
def test_bad_group_zero_min(): lcs = LineupConstraints() lcs.add_group_constraint(['Spencer Ware', 'Amari Cooper'], (0, 1))
def test_bad_group_negative_min(): lcs = LineupConstraints() lcs.add_group_constraint(['Spencer Ware', 'Amari Cooper'], (-1, 1))