<commit_before>from __future__ import (
        absolute_import, division, print_function, unicode_literals)
from builtins import (ascii, bytes, chr, dict, filter, hex, input,  # noqa
                      int, map, next, oct, open, pow, range, round,
                      str, super, zip)

import unittest

from .. import main

class TestServerPlayer(unittest.TestCase):
    def assert_status_list_lengths(self, email, your_turns, not_your_turns):
        main.get_player_games(email)
        your_turn_games, not_your_turn_games = main.get_status_lists(email)
        self.assertEqual(len(your_turn_games), your_turns)
        self.assertEqual(len(not_your_turn_games), not_your_turns)
    def test_server_player(self):
        test_player_email = "server<EMAIL>"
        test_opponent_email = "<EMAIL>"

        main.clear_games_for_player_internal(test_player_email)
        main.create_game_internal(test_player_email, test_opponent_email)
        self.assert_status_list_lengths(test_player_email, 1, 0)
        main.server_player_act(test_player_email)
        self.assert_status_list_lengths(test_player_email, 0, 1)
<commit_msg>Added a clear games for the test opponent in the test_server_player test. Currently it does not affect whether or not the test passes, but this just seems more neat.<commit_after>from __future__ import (
        absolute_import, division, print_function, unicode_literals)
from builtins import (ascii, bytes, chr, dict, filter, hex, input,  # noqa
                      int, map, next, oct, open, pow, range, round,
                      str, super, zip)

import unittest

from .. import main

class TestServerPlayer(unittest.TestCase):
    def assert_status_list_lengths(self, email, your_turns, not_your_turns):
        main.get_player_games(email)
        your_turn_games, not_your_turn_games = main.get_status_lists(email)
        self.assertEqual(len(your_turn_games), your_turns)
        self.assertEqual(len(not_your_turn_games), not_your_turns)
    def test_server_player(self):
        test_player_email = "serverplayer@localhost"
        test_opponent_email = "serverplayermock@localhost"

        main.clear_games_for_player_internal(test_player_email)
        main.clear_games_for_player_internal(test_opponent_email)
        main.create_game_internal(test_player_email, test_opponent_email)
        self.assert_status_list_lengths(test_player_email, 1, 0)
        main.server_player_act(test_player_email)
        self.assert_status_list_lengths(test_player_email, 0, 1)

{'fraction_non_alphanumeric': 0.0753370340999207, 'fraction_numerical': 0.0031720856463124504, 'mean_word_length': 3.91812865497076, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5372039', 'n_tokens_mistral': 803, 'n_tokens_neox': 771, 'n_words': 159}