def test_load_should_read_file_decode_and_set_player_path(self, mock_open):
     profile = mock.Mock()
     mock_open.read.return_value = "encoded_profile"
     with mock.patch('pythonwarrior.profile.Profile.decode',
                     return_value=profile):
         self.assertEqual(Profile.load('path/to/.profile'), profile)
         mock_open.assert_called_once_with("path/to/.profile")
Esempio n. 2
0
 def test_load_should_read_file_decode_and_set_player_path(self, mock_open):
     profile = mock.Mock()
     mock_open.read.return_value = "encoded_profile"
     with mock.patch('pythonwarrior.profile.Profile.decode',
                     return_value=profile):
         self.assertEqual(Profile.load('path/to/.profile'), profile)
         mock_open.assert_called_once_with("path/to/.profile")
Esempio n. 3
0
    def start(self):
        UI.puts('Welcome to Python Warrior')
        if os.path.exists(Config.path_prefix + '/.profile'):
            self.profile = Profile.load(Config.path_prefix + '/.profile')
        else:
            if os.path.exists(Config.path_prefix + '/python-warrior'):
                shutil.move(Config.path_prefix + '/python-warrior',
                            Config.path_prefix + '/pythonwarrior')

        if not os.path.exists(Config.path_prefix + '/pythonwarrior'):
            self.make_game_directory()
Esempio n. 4
0
    def start(self):
        UI.puts('Welcome to Python Warrior')
        if os.path.exists(Config.path_prefix + '/.profile'):
            self._profile = Profile.load(Config.path_prefix + '/.profile')
        else:
            if not os.path.exists(Config.path_prefix + '/pythonwarrior'):
                self.make_game_directory()

        if self.profile().epic:
            if self.profile().level_after_epic():
                self.go_back_to_normal_mode()
            else:
                self.play_epic_mode()
        else:
            self.play_normal_mode()
Esempio n. 5
0
    def start(self):
        UI.puts('Welcome to Python Warrior')
        if os.path.exists(Config.path_prefix + '/.profile'):
            self._profile = Profile.load(Config.path_prefix + '/.profile')
        else:
            if not os.path.exists(Config.path_prefix + '/pythonwarrior'):
                self.make_game_directory()

        if self.profile().epic:
            if self.profile().level_after_epic():
                self.go_back_to_normal_mode()
            else:
                self.play_epic_mode()
        else:
            self.play_normal_mode()
Esempio n. 6
0
 def profiles(self):
     return [Profile.load(profile) for profile in self.profile_paths()]
Esempio n. 7
0
 def profiles(self):
     return map(lambda profile: Profile.load(profile), self.profile_paths())
Esempio n. 8
0
 def profiles(self):
     return map(lambda profile: Profile.load(profile), self.profile_paths())