from die import Die from yahtzee_goals import GoalSmallStraight def make_dice(faces): """Given a list of face values, returns corresponding dice. This is a helper method used to make testing easier. """ dice = [] for face in faces: die = Die() die.face = face dice.append(die) return dice def test_small_straight(faces, expected): """Tests whether small straight works correctly. """ goal = GoalSmallStraight() result = goal.is_small_straight(make_dice(faces)) assert(result == expected) test_small_straight([1, 1, 2, 3, 4], True) test_small_straight([4, 1, 1, 2, 3], True) test_small_straight([2, 3, 4, 5, 5], True) test_small_straight([1, 3, 3, 4, 5], False)