def test_only_with_audio(self): """Test a group containing only players with audio.""" players = [self.create_mock_player(has_audio=True) for _ in range(10)] group = PlayerGroup(players) group.play() self.assert_audio_players_started(*players) self.assert_players_started(*players) self.reset_mocks(*players) group.pause() self.assert_audio_players_stopped(*players) self.assert_players_stopped(*players)
def test_mixed_players(self): """Test a group containing both players with audio and players without audio.""" players_with_audio = [self.create_mock_player(has_audio=True) for _ in range(10)] players_without_audio = [self.create_mock_player(has_audio=False) for _ in range(10)] players = players_with_audio + players_without_audio random.shuffle(players) group = PlayerGroup(players) group.play() self.assert_audio_players_started(*players_with_audio) self.assert_players_started(*players) self.reset_mocks(*players) group.pause() self.assert_audio_players_stopped(*players_with_audio) self.assert_players_stopped(*players)
def test_empty_group(self): """Just check nothing explodes on an empty group.""" group = PlayerGroup([]) group.play() group.pause()