<commit_before>import unittest

from simulation.location import Location
from simulation.avatar_manager import AvatarManager
from simulation.turn_manager import TurnManager
from simulation.world_map import WorldMap
from simulation.world_state import WorldState
from simulation.avatar import AvatarRunner
from simulation.test.dummy_player import dummy


class TestTurnManager(unittest.TestCase):
    def construct_turn_manager(self, *avatars):
        self.avatar_manager = AvatarManager(avatars)
        self.world_state = WorldState(WorldMap(), self.avatar_manager)
        self.turn_manager = TurnManager(self.world_state)

    def test_run_turn(self):
        avatar = AvatarRunner(Location(0, 0), dummy, 0)
        self.construct_turn_manager(avatar)
        self.turn_manager.run_turn()
        self.assertEqual(avatar.location, Location(1, 0))

    def test_run_several_turns(self):
        avatar = AvatarRunner(Location(0, 0), dummy, 0)
        self.construct_turn_manager(avatar)
        [self.turn_manager.run_turn() for _ in xrange(5)]
        self.assertEqual(avatar.location, Location(5, 0))

    def test_run_several_turns_and_avatars(self):
        avatar1 = AvatarRunner(Location(0, 0), dummy, 0)
        avatar2 = AvatarRunner(Location(0, 1), dummy, 1)
        self.construct_turn_manager(avatar1, avatar2)
        [self.turn_manager.run_turn() for _ in xrange(5)]
        self.assertEqual(avatar1.location, Location(5, 0))
        self.assertEqual(avatar2.location, Location(5, 1))

if __name__ == '__main__':
    unittest.main()<commit_msg>Add current directory to python path for test turn manager<commit_after>import os
import sys
sys.path.append(os.path.abspath('.'))

import unittest

from simulation.location import Location
from simulation.avatar_manager import AvatarManager
from simulation.turn_manager import TurnManager
from simulation.world_map import WorldMap
from simulation.world_state import WorldState
from simulation.avatar import AvatarRunner
from simulation.test.dummy_player import dummy

class TestTurnManager(unittest.TestCase):
    def construct_turn_manager(self, *avatars):
        self.avatar_manager = AvatarManager(avatars)
        self.world_state = WorldState(WorldMap(), self.avatar_manager)
        self.turn_manager = TurnManager(self.world_state)

    def test_run_turn(self):
        avatar = AvatarRunner(Location(0, 0), dummy, 0)
        self.construct_turn_manager(avatar)
        self.turn_manager.run_turn()
        self.assertEqual(avatar.location, Location(1, 0))

    def test_run_several_turns(self):
        avatar = AvatarRunner(Location(0, 0), dummy, 0)
        self.construct_turn_manager(avatar)
        [self.turn_manager.run_turn() for _ in xrange(5)]
        self.assertEqual(avatar.location, Location(5, 0))

    def test_run_several_turns_and_avatars(self):
        avatar1 = AvatarRunner(Location(0, 0), dummy, 0)
        avatar2 = AvatarRunner(Location(0, 1), dummy, 1)
        self.construct_turn_manager(avatar1, avatar2)
        [self.turn_manager.run_turn() for _ in xrange(5)]
        self.assertEqual(avatar1.location, Location(5, 0))
        self.assertEqual(avatar2.location, Location(5, 1))

if __name__ == '__main__':
    unittest.main()
{'fraction_non_alphanumeric': 0.09528243327126008, 'fraction_numerical': 0.01738050900062073, 'mean_word_length': 4.181672025723473, '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': '4537287', 'n_tokens_mistral': 1023, 'n_tokens_neox': 975, 'n_words': 207}