コード例 #1
0
def test_game_final_set(scores: List[int], expected_total):
    bowling_scorer = BowlingScorer()
    for score in scores:
        bowling_scorer.add_try(score)
        print(bowling_scorer.previous_try.frame_score)

    assert bowling_scorer.total_score == expected_total
コード例 #2
0
def test_bowling_spare_then_strike_then_strike(scores: List[int],
                                               expected_total):
    bowling_scorer = BowlingScorer()
    for score in scores:
        bowling_scorer.add_try(score)
        print(bowling_scorer.total_score)
        print(bowling_scorer.previous_try.is_spare)

    assert bowling_scorer.total_score == expected_total
コード例 #3
0
def test_bowling_score_first_strike_then_less_than_ten(score: int,
                                                       second_score: int):
    bowling_scorer = BowlingScorer()
    bowling_scorer.add_try(score)
    print(bowling_scorer.total_score)
    bowling_scorer.add_try(second_score)
    print(bowling_scorer.total_score)
    print(bowling_scorer.frames)
    assert bowling_scorer.total_score == score + second_score * 2
コード例 #4
0
def test_vanilla_bowling_score():
    bowling_scorer = BowlingScorer()
    assert bowling_scorer.total_score == 0
コード例 #5
0
def test_bowling_score_first_spare_then_less_than_ten(scores: List[int]):
    bowling_scorer = BowlingScorer()
    for score in scores:
        bowling_scorer.add_try(score)
        print(bowling_scorer.total_score)
    assert bowling_scorer.total_score == 12
コード例 #6
0
def test_second_try(score: int, second_score: int):
    bowling_scorer = BowlingScorer()
    bowling_scorer.add_try(score)
    bowling_scorer.add_try(second_score)
    assert bowling_scorer.total_score == 10
コード例 #7
0
def test_first_try(score):
    bowling_scorer = BowlingScorer()
    bowling_scorer.add_try(score)
    assert bowling_scorer.total_score == score