mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 04:12:13 +00:00
added encoding. Decided itertools.zip_longest was overkill, refactored to use simpler method.
This commit is contained in:
parent
1cf0963de5
commit
7333fc844e
@ -1,4 +1,4 @@
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
class TennisGameDefactored1:
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pytest
|
||||
from tennis import TennisGame
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import unittest
|
||||
from itertools import izip_longest
|
||||
|
||||
from tennis import TennisGame
|
||||
|
||||
@ -52,10 +53,10 @@ test_cases = [
|
||||
|
||||
def play_game(p1Points, p2Points, p1Name, p2Name):
|
||||
game = TennisGame(p1Name, p2Name)
|
||||
for p1, p2 in izip_longest(range(p1Points), range(p2Points)):
|
||||
if p1 is not None:
|
||||
for i in range(max(p1Points, p2Points)):
|
||||
if i < p1Points:
|
||||
game.won_point(p1Name)
|
||||
if p2 is not None:
|
||||
if i < p2Points:
|
||||
game.won_point(p2Name)
|
||||
return game
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user