def test_get_scorable_4_6_3ok(): """Test if 3ok 4 and 6 are found""" roll = np.array([4, 4, 4, 6, 6, 6]) expected = { "one": 0, "five": 0, "three-ones": False, "three-twos": False, "three-threes": False, "three-fours": True, "three-fives": False, "three-sixes": True, "four-of-a-kind": False, "three-and-one": False, "five-of-a-kind": False, "six-of-a-kind": False, "straight": False, "three-pairs": False, "four-and-pair": False, "triplets": True, } actual = analyze_roll.get_scorable(roll) assert expected == actual
def test_get_scorable_threes_5ok(): """Test if 5ok (3) and a 1 found""" roll = np.array([3, 3, 3, 3, 3, 1]) expected = { "one": 1, "five": 0, "three-ones": False, "three-twos": False, "three-threes": False, "three-fours": False, "three-fives": False, "three-sixes": False, "four-of-a-kind": False, "three-and-one": False, "five-of-a-kind": True, "six-of-a-kind": False, "straight": False, "three-pairs": False, "four-and-pair": False, "triplets": False, } actual = analyze_roll.get_scorable(roll) assert expected == actual
def test_get_scorable_twos_34okp(): """Test if twos and 4ok and pair found""" roll = np.array([2, 2, 2, 2, 6, 6]) expected = { "one": 0, "five": 0, "three-ones": False, "three-twos": False, "three-threes": False, "three-fours": False, "three-fives": False, "three-sixes": False, "four-of-a-kind": True, "three-and-one": False, "five-of-a-kind": False, "six-of-a-kind": False, "straight": False, "three-pairs": False, "four-and-pair": True, "triplets": False, } actual = analyze_roll.get_scorable(roll) assert expected == actual
def test_get_scorable_three_and_1(): """Test if 4 ones are treated as 3 + 1""" roll = np.array([1, 1, 1, 1, 2, 5]) expected = { "one": 4, "five": 1, "three-ones": False, "three-twos": False, "three-threes": False, "three-fours": False, "three-fives": False, "three-sixes": False, "four-of-a-kind": False, "three-and-one": True, "five-of-a-kind": False, "six-of-a-kind": False, "straight": False, "three-pairs": False, "four-and-pair": False, "triplets": False, } actual = analyze_roll.get_scorable(roll) assert expected == actual
def test_get_scorable_partial_roll_4ok_4(): """Test if 4ok 4 pair is found""" roll = np.array([4, 4, 4, 4, 2]) expected = { "one": 0, "five": 0, "three-ones": False, "three-twos": False, "three-threes": False, "three-fours": False, "three-fives": False, "three-sixes": False, "four-of-a-kind": True, "three-and-one": False, "five-of-a-kind": False, "six-of-a-kind": False, "straight": False, "three-pairs": False, "four-and-pair": False, "triplets": False, } actual = analyze_roll.get_scorable(roll) assert expected == actual
def test_get_scorable_ones_fives(): """Test if ones, fives, and triplets are found""" roll = np.array([1, 1, 1, 5, 5, 5]) expected = { "one": 3, "five": 3, "three-ones": True, "three-twos": False, "three-threes": False, "three-fours": False, "three-fives": True, "three-sixes": False, "four-of-a-kind": False, "three-and-one": False, "five-of-a-kind": False, "six-of-a-kind": False, "straight": False, "three-pairs": False, "four-and-pair": False, "triplets": True, } actual = analyze_roll.get_scorable(roll) assert expected == actual
def test_score_ones_fives_triplets(): """Test if triplets of 1s and 5s is properly scored""" roll = np.array([1, 1, 1, 5, 5, 5]) expected = [[], [("triplets", 2500, 6)]] actual = score_roll.count_gathered(analyze_roll.get_scorable(roll)) assert expected == actual
def test_score_triplet_and_singles(): """Test if ones and fives are counted when a triplet is found""" roll = np.array([6, 5, 2, 1, 2, 2]) expected = [[("one", 100, 1), ("five", 50, 1)], [("three-twos", 200, 3)]] actual = score_roll.count_gathered(analyze_roll.get_scorable(roll)) assert expected == actual
def test_score_four_and_pair_1and5(): """Test if a four and pair is properly scored when 1s and 5s are rolled""" roll = np.array([1, 1, 1, 1, 5, 5]) expected = [[], [("four-and-pair", 1500, 6)]] actual = score_roll.count_gathered(analyze_roll.get_scorable(roll)) assert expected == actual
def test_score_straight(): """Test if a straight is properly scored""" roll = np.array([5, 1, 4, 3, 2, 6]) expected = [[], [("straight", 1500, 6)]] actual = score_roll.count_gathered(analyze_roll.get_scorable(roll)) assert expected == actual
def test_score_ones_fives_pairs(): """Test if pairs of 1s and 5s are properly scored""" roll = np.array([1, 1, 5, 5, 2, 2]) expected = [[], [("three-pairs", 1500, 6)]] actual = score_roll.count_gathered(analyze_roll.get_scorable(roll)) assert expected == actual