<commit_before>import unittest
from source.referee_2_chair import *
from source.announcer_chair import *
from source.player_chair import *
from source.game_table import *
from source.judge_pit import*

class MuteAnnouncer(Announcer):
    def show(self, statement):
        return statement

class DummyHuman(Player):
    name = 'human'
        
class DummyComp(Player):
    name = 'computer'

class DummyTable(TableTop):
    def __init__(self):
        self.board = [0,0,0, 0,0,0, 0,0,0]
        self.noughts = 10
        self.crosses = 1
        self.player1 = DummyHuman(self.crosses)
        self.player2 = DummyComp(self.noughts)
        self.whos_turn = self.player1

    def give_computer_the_first_move(self):
        self.player1 = DummyComp(self.crosses)
        self.player2 = DummyHuman(self.noughts)
        self.whos_turn = self.player1

class DummyRef(Referee):
    def __init__(self, board_object):
        self.table_top = board_object
        self.judge = Judge(self.table_top)
        self.announcer = MuteAnnouncer()
        self.moves_taken = 0
    

class RefereeTestCase(unittest.TestCase):

    def setUp(self):
        self.table_top = DummyTable()
        self.ref = DummyRef(self.table_top)
        self.announcer = MuteAnnouncer()
        self.expected_board = [1,0,0, 0,0,0, 0,0,0]

    def test_referee_ties_when_all_squares_taken_no_winner(self):
        pass

    def test_referee_returns_win_even_if_all_squares_taken(self):
        pass

    def test_referee_switches_players_when_it_takes_a_turn(self):
        self.ref.take_a_turn()
        test_yields = self.ref.table_top.whos_turn
        self.assertEqual(test_yields, self.ref.table_top.player2)

    def test_referee_moves_taken_plus_1_when_it_takes_a_turn(self):
        self.ref.take_a_turn()
        self.assertEqual(self.ref.moves_taken, 1)

    def test_referee_changes_the_board_when_it_takes_a_turn(self):
        self.ref.take_a_turn()
        test_yields = self.ref.table_top.board
        self.assertEqual(test_yields, self.expected_board)

    def test_show_board_shows_the_board(self):
        board = self.announcer.render_board(self.table_top.board)
        expected = self.announcer.show(board)
        test_yields = self.ref.show_board()
        self.assertEqual(test_yields, expected)<commit_msg>assert referee returns the winner of a won board<commit_after>import unittest
from source.referee_2_chair import *
from source.announcer_chair import *
from source.player_chair import *
from source.game_table import *
from source.judge_pit import*

class MuteAnnouncer(Announcer):
    def show(self, statement):
        return statement

class DummyHuman(Player):
    name = 'human'
        
class DummyComp(Player):
    name = 'computer'

class DummyTable(TableTop):
    def __init__(self):
        self.board = [0,0,0, 0,0,0, 0,0,0]
        self.noughts = 10
        self.crosses = 1
        self.player1 = DummyHuman(self.crosses)
        self.player2 = DummyComp(self.noughts)
        self.whos_turn = self.player1

    def give_computer_the_first_move(self):
        self.player1 = DummyComp(self.crosses)
        self.player2 = DummyHuman(self.noughts)
        self.whos_turn = self.player1

class DummyRef(Referee):
    def __init__(self, board_object):
        self.table_top = board_object
        self.judge = Judge(self.table_top)
        self.announcer = MuteAnnouncer()
        self.moves_taken = 0
    

class RefereeTestCase(unittest.TestCase):

    def setUp(self):
        self.table_top = DummyTable()
        self.ref = DummyRef(self.table_top)
        self.announcer = MuteAnnouncer()
        self.first_move_board = [1,0,0, 0,0,0, 0,0,0]
        self.won_board = [1,10,1, 10,1,10, 1,0,0] 

    def test_referee_ties_when_all_squares_taken_no_winner(self):
        pass

    def test_referee_returns_win_even_if_all_squares_taken(self):
        self.ref.table_top.board = self.won_board
        self.assertEqual(self.ref.facilitate_turns(), 'human')

    def test_referee_switches_players_when_it_takes_a_turn(self):
        self.ref.take_a_turn()
        test_yields = self.ref.table_top.whos_turn
        self.assertEqual(test_yields, self.ref.table_top.player2)

    def test_referee_moves_taken_plus_1_when_it_takes_a_turn(self):
        self.ref.take_a_turn()
        self.assertEqual(self.ref.moves_taken, 1)

    def test_referee_changes_the_board_when_it_takes_a_turn(self):
        self.ref.take_a_turn()
        test_yields = self.ref.table_top.board
        self.assertEqual(test_yields, self.first_move_board)

    def test_show_board_shows_the_board(self):
        board = self.announcer.render_board(self.table_top.board)
        expected = self.announcer.show(board)
        test_yields = self.ref.show_board()
        self.assertEqual(test_yields, expected)
{'fraction_non_alphanumeric': 0.09403669724770643, 'fraction_numerical': 0.0158465387823186, 'mean_word_length': 3.2488928255093, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1052465', 'n_tokens_mistral': 1751, 'n_tokens_neox': 1686, 'n_words': 254}