Skip to content

Instantly share code, notes, and snippets.



Last active Mar 19, 2019
What would you like to do?
An illustrative snippet for the blog post
import pytest
@pytest.mark.parametrize('state', [
def test_game_has_winner(state):
game = Game(state)
assert game.has_winner()
class Game:
def __init__(self, state):
self.state = state_from_string(state)
def has_winner(self):
pass # check rows, columns, and diagonals
def state_from_string(line):
return [list(row) for row in line.split('|')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment