<s> from __future__ import absolute_import , unicode_literals <EOL> import time <EOL> import unittest <EOL> import mock <EOL> import pykka <EOL> from mopidy import core <EOL> from mopidy . core import PlaybackState <EOL> from mopidy . internal import deprecation <EOL> from mopidy . local import actor <EOL> from mopidy . models import TlTrack , Track <EOL> from tests import dummy_audio , path_to_data_dir <EOL> from tests . local import generate_song , populate_tracklist <EOL> class LocalPlaybackProviderTest ( unittest . TestCase ) : <EOL> config = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : path_to_data_dir ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : path_to_data_dir ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> } <EOL> tracks = [ <EOL> Track ( uri = generate_song ( i ) , length = <NUM_LIT> ) for i in ( <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ) ] <EOL> def add_track ( self , uri ) : <EOL> track = Track ( uri = uri , length = <NUM_LIT> ) <EOL> self . tracklist . add ( [ track ] ) <EOL> def trigger_about_to_finish ( self ) : <EOL> self . playback . get_current_tl_track ( ) . get ( ) <EOL> callback = self . audio . get_about_to_finish_callback ( ) . get ( ) <EOL> callback ( ) <EOL> def run ( self , result = None ) : <EOL> with deprecation . ignore ( '<STR_LIT>' ) : <EOL> return super ( LocalPlaybackProviderTest , self ) . run ( result ) <EOL> def setUp ( self ) : <EOL> self . audio = dummy_audio . create_proxy ( ) <EOL> self . backend = actor . LocalBackend . start ( <EOL> config = self . config , audio = self . audio ) . proxy ( ) <EOL> self . core = core . Core . start ( audio = self . audio , <EOL> backends = [ self . backend ] , <EOL> config = self . config ) . proxy ( ) <EOL> self . playback = self . core . playback <EOL> self . tracklist = self . core . tracklist <EOL> assert len ( self . tracks ) >= <NUM_LIT:3> , '<STR_LIT>' <EOL> assert self . tracks [ <NUM_LIT:0> ] . length >= <NUM_LIT> , '<STR_LIT>' <EOL> def tearDown ( self ) : <EOL> pykka . ActorRegistry . stop_all ( ) <EOL> def assert_state_is ( self , state ) : <EOL> self . assertEqual ( self . playback . get_state ( ) . get ( ) , state ) <EOL> def assert_current_track_is ( self , track ) : <EOL> self . assertEqual ( self . playback . get_current_track ( ) . get ( ) , track ) <EOL> def assert_current_track_is_not ( self , track ) : <EOL> self . assertNotEqual ( self . playback . get_current_track ( ) . get ( ) , track ) <EOL> def assert_current_track_index_is ( self , index ) : <EOL> tl_track = self . playback . get_current_tl_track ( ) . get ( ) <EOL> self . assertEqual ( self . tracklist . index ( tl_track ) . get ( ) , index ) <EOL> def assert_next_tl_track_is ( self , tl_track ) : <EOL> current = self . playback . get_current_tl_track ( ) . get ( ) <EOL> self . assertEqual ( self . tracklist . next_track ( current ) . get ( ) , tl_track ) <EOL> def assert_next_tl_track_is_not ( self , tl_track ) : <EOL> current = self . playback . get_current_tl_track ( ) . get ( ) <EOL> self . assertNotEqual ( self . tracklist . next_track ( current ) . get ( ) , tl_track ) <EOL> def assert_previous_tl_track_is ( self , tl_track ) : <EOL> current = self . playback . get_current_tl_track ( ) . get ( ) <EOL> previous = self . tracklist . previous_track ( current ) . get ( ) <EOL> self . assertEqual ( previous , tl_track ) <EOL> def assert_eot_tl_track_is ( self , tl_track ) : <EOL> current = self . playback . get_current_tl_track ( ) . get ( ) <EOL> self . assertEqual ( self . tracklist . eot_track ( current ) . get ( ) , tl_track ) <EOL> def assert_eot_tl_track_is_not ( self , tl_track ) : <EOL> current = self . playback . get_current_tl_track ( ) . get ( ) <EOL> self . assertNotEqual ( self . tracklist . eot_track ( current ) . get ( ) , tl_track ) <EOL> def test_uri_scheme ( self ) : <EOL> self . assertNotIn ( '<STR_LIT:file>' , self . core . uri_schemes . get ( ) ) <EOL> self . assertIn ( '<STR_LIT>' , self . core . uri_schemes . get ( ) ) <EOL> def test_play_mp3 ( self ) : <EOL> self . add_track ( '<STR_LIT>' ) <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> def test_play_ogg ( self ) : <EOL> self . add_track ( '<STR_LIT>' ) <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> def test_play_flac ( self ) : <EOL> self . add_track ( '<STR_LIT>' ) <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> def test_play_uri_with_non_ascii_bytes ( self ) : <EOL> self . add_track ( '<STR_LIT>' ) <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> def test_initial_state_is_stopped ( self ) : <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> def test_play_with_empty_playlist ( self ) : <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> def test_play_with_empty_playlist_return_value ( self ) : <EOL> self . assertEqual ( self . playback . play ( ) . get ( ) , None ) <EOL> @ populate_tracklist <EOL> def test_play_state ( self ) : <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> @ populate_tracklist <EOL> def test_play_return_value ( self ) : <EOL> self . assertEqual ( self . playback . play ( ) . get ( ) , None ) <EOL> @ populate_tracklist <EOL> def test_play_track_state ( self ) : <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> self . playback . play ( self . tl_tracks . get ( ) [ - <NUM_LIT:1> ] ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> @ populate_tracklist <EOL> def test_play_track_return_value ( self ) : <EOL> self . assertIsNone ( self . playback . play ( self . tl_tracks . get ( ) [ - <NUM_LIT:1> ] ) . get ( ) ) <EOL> @ populate_tracklist <EOL> def test_play_when_playing ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> track = self . playback . get_current_track ( ) . get ( ) <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_current_track_is ( track ) <EOL> @ populate_tracklist <EOL> def test_play_when_paused ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> track = self . playback . get_current_track ( ) . get ( ) <EOL> self . playback . pause ( ) . get ( ) <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> self . assert_current_track_is ( track ) <EOL> @ populate_tracklist <EOL> def test_play_when_paused_after_next ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> track = self . playback . get_current_track ( ) . get ( ) <EOL> self . playback . pause ( ) . get ( ) <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> self . assert_current_track_is ( track ) <EOL> @ populate_tracklist <EOL> def test_play_sets_current_track ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:0> ] ) <EOL> @ populate_tracklist <EOL> def test_play_track_sets_current_track ( self ) : <EOL> self . playback . play ( self . tl_tracks . get ( ) [ - <NUM_LIT:1> ] ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ - <NUM_LIT:1> ] ) <EOL> @ populate_tracklist <EOL> def test_play_skips_to_next_track_on_failure ( self ) : <EOL> uri = self . backend . playback . translate_uri ( self . tracks [ <NUM_LIT:0> ] . uri ) . get ( ) <EOL> self . audio . trigger_fake_playback_failure ( uri ) <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_current_track_is_not ( self . tracks [ <NUM_LIT:0> ] ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:1> ] ) <EOL> @ populate_tracklist <EOL> def test_current_track_after_completed_playlist ( self ) : <EOL> self . playback . play ( self . tl_tracks . get ( ) [ - <NUM_LIT:1> ] ) . get ( ) <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> self . assert_current_track_is ( None ) <EOL> self . playback . play ( self . tl_tracks . get ( ) [ - <NUM_LIT:1> ] ) . get ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> self . assert_current_track_is ( None ) <EOL> @ populate_tracklist <EOL> def test_previous ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . playback . previous ( ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:0> ] ) <EOL> @ populate_tracklist <EOL> def test_previous_more ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . playback . previous ( ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:1> ] ) <EOL> @ populate_tracklist <EOL> def test_previous_return_value ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . assertIsNone ( self . playback . previous ( ) . get ( ) ) <EOL> @ populate_tracklist <EOL> def test_previous_does_not_trigger_playback ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . playback . stop ( ) <EOL> self . playback . previous ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> @ populate_tracklist <EOL> def test_previous_at_start_of_playlist ( self ) : <EOL> self . playback . previous ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> self . assert_current_track_is ( None ) <EOL> def test_previous_for_empty_playlist ( self ) : <EOL> self . playback . previous ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> self . assert_current_track_is ( None ) <EOL> @ populate_tracklist <EOL> def test_previous_skips_to_previous_track_on_failure ( self ) : <EOL> uri = self . backend . playback . translate_uri ( self . tracks [ <NUM_LIT:1> ] . uri ) . get ( ) <EOL> self . audio . trigger_fake_playback_failure ( uri ) <EOL> self . playback . play ( self . tl_tracks . get ( ) [ <NUM_LIT:2> ] ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:2> ] ) <EOL> self . playback . previous ( ) . get ( ) <EOL> self . assert_current_track_is_not ( self . tracks [ <NUM_LIT:1> ] ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:0> ] ) <EOL> @ populate_tracklist <EOL> def test_next ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> old_track = self . playback . get_current_track ( ) . get ( ) <EOL> old_position = self . tracklist . index ( ) . get ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . assertEqual ( self . tracklist . index ( ) . get ( ) , old_position + <NUM_LIT:1> ) <EOL> self . assert_current_track_is_not ( old_track ) <EOL> @ populate_tracklist <EOL> def test_next_return_value ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . assertEqual ( self . playback . next ( ) . get ( ) , None ) <EOL> @ populate_tracklist <EOL> def test_next_does_not_trigger_playback ( self ) : <EOL> self . playback . next ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> @ populate_tracklist <EOL> def test_next_at_end_of_playlist ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> for i , track in enumerate ( self . tracks ) : <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> self . assert_current_track_is ( track ) <EOL> self . assertEqual ( self . tracklist . index ( ) . get ( ) , i ) <EOL> self . playback . next ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> @ populate_tracklist <EOL> def test_next_until_end_of_playlist_and_play_from_start ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> for _ in self . tracks : <EOL> self . playback . next ( ) . get ( ) <EOL> self . assert_current_track_is ( None ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:0> ] ) <EOL> def test_next_for_empty_playlist ( self ) : <EOL> self . playback . next ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> @ populate_tracklist <EOL> def test_next_skips_to_next_track_on_failure ( self ) : <EOL> uri = self . backend . playback . translate_uri ( self . tracks [ <NUM_LIT:1> ] . uri ) . get ( ) <EOL> self . audio . trigger_fake_playback_failure ( uri ) <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:0> ] ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . assert_current_track_is_not ( self . tracks [ <NUM_LIT:1> ] ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:2> ] ) <EOL> @ populate_tracklist <EOL> def test_next_track_before_play ( self ) : <EOL> self . assert_next_tl_track_is ( self . tl_tracks . get ( ) [ <NUM_LIT:0> ] ) <EOL> @ populate_tracklist <EOL> def test_next_track_during_play ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_next_tl_track_is ( self . tl_tracks . get ( ) [ <NUM_LIT:1> ] ) <EOL> @ populate_tracklist <EOL> def test_next_track_after_previous ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . playback . previous ( ) . get ( ) <EOL> self . assert_next_tl_track_is ( self . tl_tracks . get ( ) [ <NUM_LIT:1> ] ) <EOL> def test_next_track_empty_playlist ( self ) : <EOL> self . assert_next_tl_track_is ( None ) <EOL> @ populate_tracklist <EOL> def test_next_track_at_end_of_playlist ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> for _ in self . tl_tracks . get ( ) [ <NUM_LIT:1> : ] : <EOL> self . playback . next ( ) . get ( ) <EOL> self . assert_next_tl_track_is ( None ) <EOL> @ populate_tracklist <EOL> def test_next_track_at_end_of_playlist_with_repeat ( self ) : <EOL> self . tracklist . repeat = True <EOL> self . playback . play ( ) . get ( ) <EOL> for _ in self . tracks [ <NUM_LIT:1> : ] : <EOL> self . playback . next ( ) . get ( ) <EOL> self . assert_next_tl_track_is ( self . tl_tracks . get ( ) [ <NUM_LIT:0> ] ) <EOL> @ populate_tracklist <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> def test_next_track_with_random ( self , shuffle_mock ) : <EOL> shuffle_mock . side_effect = lambda tracks : tracks . reverse ( ) <EOL> self . tracklist . random = True <EOL> self . assert_next_tl_track_is ( self . tl_tracks . get ( ) [ - <NUM_LIT:1> ] ) <EOL> @ populate_tracklist <EOL> def test_next_with_consume ( self ) : <EOL> self . tracklist . consume = True <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . assertNotIn ( self . tracks [ <NUM_LIT:0> ] , self . tracklist . get_tracks ( ) . get ( ) ) <EOL> @ populate_tracklist <EOL> def test_next_with_single_and_repeat ( self ) : <EOL> self . tracklist . single = True <EOL> self . tracklist . repeat = True <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:0> ] ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:1> ] ) <EOL> @ populate_tracklist <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> def test_next_with_random ( self , shuffle_mock ) : <EOL> shuffle_mock . side_effect = lambda tracks : tracks . reverse ( ) <EOL> self . tracklist . random = True <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ - <NUM_LIT:1> ] ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ - <NUM_LIT:2> ] ) <EOL> @ populate_tracklist <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> def test_next_track_with_random_after_append_playlist ( self , shuffle_mock ) : <EOL> shuffle_mock . side_effect = lambda tracks : tracks . reverse ( ) <EOL> self . tracklist . random = True <EOL> current_tl_track = self . playback . get_current_tl_track ( ) . get ( ) <EOL> expected_tl_track = self . tl_tracks . get ( ) [ - <NUM_LIT:1> ] <EOL> next_tl_track = self . tracklist . next_track ( current_tl_track ) . get ( ) <EOL> self . assertEqual ( next_tl_track , expected_tl_track ) <EOL> self . tracklist . add ( self . tracks [ : <NUM_LIT:1> ] ) <EOL> old_next_tl_track = next_tl_track <EOL> expected_tl_track = self . tracklist . tl_tracks . get ( ) [ - <NUM_LIT:1> ] <EOL> next_tl_track = self . tracklist . next_track ( current_tl_track ) . get ( ) <EOL> self . assertEqual ( next_tl_track , expected_tl_track ) <EOL> self . assertNotEqual ( next_tl_track , old_next_tl_track ) <EOL> @ populate_tracklist <EOL> def test_end_of_track ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> old_track = self . playback . get_current_track ( ) . get ( ) <EOL> old_position = self . tracklist . index ( ) . get ( ) <EOL> self . trigger_about_to_finish ( ) <EOL> new_track = self . playback . get_current_track ( ) . get ( ) <EOL> self . assertEqual ( self . tracklist . index ( ) . get ( ) , old_position + <NUM_LIT:1> ) <EOL> self . assertNotEqual ( new_track . uri , old_track . uri ) <EOL> @ populate_tracklist <EOL> def test_end_of_track_return_value ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . assertEqual ( self . trigger_about_to_finish ( ) , None ) <EOL> @ populate_tracklist <EOL> def test_end_of_track_does_not_trigger_playback ( self ) : <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> @ populate_tracklist <EOL> def test_end_of_track_at_end_of_playlist ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> for i , track in enumerate ( self . tracks ) : <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> self . assert_current_track_is ( track ) <EOL> self . assertEqual ( self . tracklist . index ( ) . get ( ) , i ) <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> @ populate_tracklist <EOL> def test_end_of_track_until_end_of_playlist_and_play_from_start ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> for _ in self . tracks : <EOL> self . trigger_about_to_finish ( ) <EOL> self . assertEqual ( self . playback . get_current_track ( ) . get ( ) , None ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:0> ] ) <EOL> def test_end_of_track_for_empty_playlist ( self ) : <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> @ unittest . expectedFailure <EOL> @ populate_tracklist <EOL> def test_end_of_track_skips_to_next_track_on_failure ( self ) : <EOL> return_values = [ True , False , True ] <EOL> self . backend . playback . play = lambda : return_values . pop ( ) <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:0> ] ) <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_current_track_is_not ( self . tracks [ <NUM_LIT:1> ] ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:2> ] ) <EOL> @ populate_tracklist <EOL> def test_end_of_track_track_before_play ( self ) : <EOL> self . assert_next_tl_track_is ( self . tl_tracks . get ( ) [ <NUM_LIT:0> ] ) <EOL> @ populate_tracklist <EOL> def test_end_of_track_track_during_play ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_next_tl_track_is ( self . tl_tracks . get ( ) [ <NUM_LIT:1> ] ) <EOL> @ populate_tracklist <EOL> def test_about_to_finish_after_previous ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . trigger_about_to_finish ( ) <EOL> self . playback . previous ( ) . get ( ) <EOL> self . assert_next_tl_track_is ( self . tl_tracks . get ( ) [ <NUM_LIT:1> ] ) <EOL> def test_end_of_track_track_empty_playlist ( self ) : <EOL> self . assert_next_tl_track_is ( None ) <EOL> @ populate_tracklist <EOL> def test_end_of_track_track_at_end_of_playlist ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> for _ in self . tracks [ <NUM_LIT:1> : ] : <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_next_tl_track_is ( None ) <EOL> @ populate_tracklist <EOL> def test_end_of_track_track_at_end_of_playlist_with_repeat ( self ) : <EOL> self . tracklist . repeat = True <EOL> self . playback . play ( ) . get ( ) <EOL> for _ in self . tracks [ <NUM_LIT:1> : ] : <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_next_tl_track_is ( self . tl_tracks . get ( ) [ <NUM_LIT:0> ] ) <EOL> @ populate_tracklist <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> def test_end_of_track_track_with_random ( self , shuffle_mock ) : <EOL> shuffle_mock . side_effect = lambda tracks : tracks . reverse ( ) <EOL> self . tracklist . random = True <EOL> self . assert_next_tl_track_is ( self . tl_tracks . get ( ) [ - <NUM_LIT:1> ] ) <EOL> @ populate_tracklist <EOL> def test_end_of_track_with_consume ( self ) : <EOL> self . tracklist . consume = True <EOL> self . playback . play ( ) . get ( ) <EOL> self . trigger_about_to_finish ( ) <EOL> self . assertNotIn ( self . tracks [ <NUM_LIT:0> ] , self . tracklist . get_tracks ( ) . get ( ) ) <EOL> @ populate_tracklist <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> def test_end_of_track_with_random ( self , shuffle_mock ) : <EOL> shuffle_mock . side_effect = lambda tracks : tracks . reverse ( ) <EOL> self . tracklist . random = True <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ - <NUM_LIT:1> ] ) <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_current_track_is ( self . tracks [ - <NUM_LIT:2> ] ) <EOL> @ populate_tracklist <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> def test_end_of_track_track_with_random_after_append_playlist ( <EOL> self , shuffle_mock ) : <EOL> shuffle_mock . side_effect = lambda tracks : tracks . reverse ( ) <EOL> self . tracklist . random = True <EOL> current_tl_track = self . playback . get_current_tl_track ( ) . get ( ) <EOL> expected_tl_track = self . tracklist . get_tl_tracks ( ) . get ( ) [ - <NUM_LIT:1> ] <EOL> eot_tl_track = self . tracklist . eot_track ( current_tl_track ) . get ( ) <EOL> self . assertEqual ( eot_tl_track , expected_tl_track ) <EOL> self . tracklist . add ( self . tracks [ : <NUM_LIT:1> ] ) <EOL> old_eot_tl_track = eot_tl_track <EOL> expected_tl_track = self . tracklist . get_tl_tracks ( ) . get ( ) [ - <NUM_LIT:1> ] <EOL> eot_tl_track = self . tracklist . eot_track ( current_tl_track ) . get ( ) <EOL> self . assertEqual ( eot_tl_track , expected_tl_track ) <EOL> self . assertNotEqual ( eot_tl_track , old_eot_tl_track ) <EOL> @ populate_tracklist <EOL> def test_previous_track_before_play ( self ) : <EOL> self . assert_previous_tl_track_is ( None ) <EOL> @ populate_tracklist <EOL> def test_previous_track_after_play ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_previous_tl_track_is ( None ) <EOL> @ populate_tracklist <EOL> def test_previous_track_after_next ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . assert_previous_tl_track_is ( self . tl_tracks . get ( ) [ <NUM_LIT:0> ] ) <EOL> @ populate_tracklist <EOL> def test_previous_track_after_previous ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . playback . previous ( ) . get ( ) <EOL> self . assert_previous_tl_track_is ( self . tl_tracks . get ( ) [ <NUM_LIT:0> ] ) <EOL> def test_previous_track_empty_playlist ( self ) : <EOL> self . assert_previous_tl_track_is ( None ) <EOL> @ populate_tracklist <EOL> def test_previous_track_with_consume ( self ) : <EOL> self . tracklist . consume = True <EOL> for _ in self . tracks : <EOL> self . playback . next ( ) <EOL> current = self . playback . get_current_tl_track ( ) . get ( ) <EOL> self . assert_previous_tl_track_is ( current ) <EOL> @ populate_tracklist <EOL> def test_previous_track_with_random ( self ) : <EOL> self . tracklist . random = True <EOL> for _ in self . tracks : <EOL> self . playback . next ( ) <EOL> current = self . playback . get_current_tl_track ( ) . get ( ) <EOL> self . assert_previous_tl_track_is ( current ) <EOL> @ populate_tracklist <EOL> def test_initial_current_track ( self ) : <EOL> self . assert_current_track_is ( None ) <EOL> @ populate_tracklist <EOL> def test_current_track_during_play ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:0> ] ) <EOL> @ populate_tracklist <EOL> def test_current_track_after_next ( self ) : <EOL> self . playback . play ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:1> ] ) <EOL> @ populate_tracklist <EOL> def test_initial_tracklist_position ( self ) : <EOL> self . assertEqual ( self . tracklist . index ( ) . get ( ) , None ) <EOL> @ populate_tracklist <EOL> def test_tracklist_position_during_play ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_current_track_index_is ( <NUM_LIT:0> ) <EOL> @ populate_tracklist <EOL> def test_tracklist_position_after_next ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> self . assert_current_track_index_is ( <NUM_LIT:1> ) <EOL> @ populate_tracklist <EOL> def test_tracklist_position_at_end_of_playlist ( self ) : <EOL> self . playback . play ( self . tl_tracks . get ( ) [ - <NUM_LIT:1> ] ) . get ( ) <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_current_track_index_is ( None ) <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> def test_on_tracklist_change_gets_called ( self , change_mock ) : <EOL> self . tracklist . add ( [ Track ( ) ] ) . get ( ) <EOL> change_mock . assert_called_once_with ( ) <EOL> @ populate_tracklist <EOL> def test_on_tracklist_change_when_playing ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> current_track = self . playback . get_current_track ( ) . get ( ) <EOL> self . tracklist . add ( [ self . tracks [ <NUM_LIT:2> ] ] ) <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> self . assert_current_track_is ( current_track ) <EOL> @ populate_tracklist <EOL> def test_on_tracklist_change_when_stopped ( self ) : <EOL> self . tracklist . add ( [ self . tracks [ <NUM_LIT:2> ] ] ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> self . assert_current_track_is ( None ) <EOL> @ populate_tracklist <EOL> def test_on_tracklist_change_when_paused ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . pause ( ) <EOL> current_track = self . playback . get_current_track ( ) . get ( ) <EOL> self . tracklist . add ( [ self . tracks [ <NUM_LIT:2> ] ] ) <EOL> self . assert_state_is ( PlaybackState . PAUSED ) <EOL> self . assert_current_track_is ( current_track ) <EOL> @ populate_tracklist <EOL> def test_pause_when_stopped ( self ) : <EOL> self . playback . pause ( ) <EOL> self . assert_state_is ( PlaybackState . PAUSED ) <EOL> @ populate_tracklist <EOL> def test_pause_when_playing ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . pause ( ) <EOL> self . assert_state_is ( PlaybackState . PAUSED ) <EOL> @ populate_tracklist <EOL> def test_pause_when_paused ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . pause ( ) <EOL> self . playback . pause ( ) <EOL> self . assert_state_is ( PlaybackState . PAUSED ) <EOL> @ populate_tracklist <EOL> def test_pause_return_value ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . assertIsNone ( self . playback . pause ( ) . get ( ) ) <EOL> @ populate_tracklist <EOL> def test_resume_when_stopped ( self ) : <EOL> self . playback . resume ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> @ populate_tracklist <EOL> def test_resume_when_playing ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . resume ( ) <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> @ populate_tracklist <EOL> def test_resume_when_paused ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . pause ( ) <EOL> self . playback . resume ( ) <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> @ populate_tracklist <EOL> def test_resume_return_value ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . pause ( ) <EOL> self . assertIsNone ( self . playback . resume ( ) . get ( ) ) <EOL> @ unittest . SkipTest <EOL> @ populate_tracklist <EOL> def test_resume_continues_from_right_position ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> time . sleep ( <NUM_LIT> ) <EOL> self . playback . pause ( ) <EOL> self . playback . resume ( ) <EOL> self . assertNotEqual ( self . playback . time_position , <NUM_LIT:0> ) <EOL> @ populate_tracklist <EOL> def test_seek_when_stopped ( self ) : <EOL> result = self . playback . seek ( <NUM_LIT:1000> ) <EOL> self . assert_ ( result , '<STR_LIT>' % result ) <EOL> @ populate_tracklist <EOL> def test_seek_when_stopped_updates_position ( self ) : <EOL> self . playback . seek ( <NUM_LIT:1000> ) . get ( ) <EOL> position = self . playback . time_position <EOL> self . assertGreaterEqual ( position , <NUM_LIT> ) <EOL> def test_seek_on_empty_playlist ( self ) : <EOL> self . assertFalse ( self . playback . seek ( <NUM_LIT:0> ) . get ( ) ) <EOL> def test_seek_on_empty_playlist_updates_position ( self ) : <EOL> self . playback . seek ( <NUM_LIT:0> ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> @ populate_tracklist <EOL> def test_seek_when_stopped_triggers_play ( self ) : <EOL> self . playback . seek ( <NUM_LIT:0> ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> @ populate_tracklist <EOL> def test_seek_when_playing ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> result = self . playback . seek ( self . tracks [ <NUM_LIT:0> ] . length - <NUM_LIT:1000> ) <EOL> self . assert_ ( result , '<STR_LIT>' % result ) <EOL> @ populate_tracklist <EOL> def test_seek_when_playing_updates_position ( self ) : <EOL> length = self . tracks [ <NUM_LIT:0> ] . length <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . seek ( length - <NUM_LIT:1000> ) . get ( ) <EOL> position = self . playback . get_time_position ( ) . get ( ) <EOL> self . assertGreaterEqual ( position , length - <NUM_LIT> ) <EOL> @ populate_tracklist <EOL> def test_seek_when_paused ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . pause ( ) <EOL> result = self . playback . seek ( self . tracks [ <NUM_LIT:0> ] . length - <NUM_LIT:1000> ) <EOL> self . assert_ ( result , '<STR_LIT>' % result ) <EOL> self . assert_state_is ( PlaybackState . PAUSED ) <EOL> @ populate_tracklist <EOL> def test_seek_when_paused_updates_position ( self ) : <EOL> length = self . tracks [ <NUM_LIT:0> ] . length <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . pause ( ) <EOL> self . playback . seek ( length - <NUM_LIT:1000> ) <EOL> position = self . playback . get_time_position ( ) . get ( ) <EOL> self . assertGreaterEqual ( position , length - <NUM_LIT> ) <EOL> @ unittest . SkipTest <EOL> @ populate_tracklist <EOL> def test_seek_beyond_end_of_song ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> result = self . playback . seek ( self . tracks [ <NUM_LIT:0> ] . length * <NUM_LIT:100> ) <EOL> self . assert_ ( not result , '<STR_LIT>' % result ) <EOL> @ populate_tracklist <EOL> def test_seek_beyond_end_of_song_jumps_to_next_song ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . seek ( self . tracks [ <NUM_LIT:0> ] . length * <NUM_LIT:100> ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:1> ] ) <EOL> @ populate_tracklist <EOL> def test_seek_beyond_end_of_song_for_last_track ( self ) : <EOL> self . playback . play ( self . tl_tracks . get ( ) [ - <NUM_LIT:1> ] ) . get ( ) <EOL> self . playback . seek ( self . tracks [ - <NUM_LIT:1> ] . length * <NUM_LIT:100> ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> @ populate_tracklist <EOL> def test_stop_when_stopped ( self ) : <EOL> self . playback . stop ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> @ populate_tracklist <EOL> def test_stop_when_playing ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . stop ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> @ populate_tracklist <EOL> def test_stop_when_paused ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . pause ( ) <EOL> self . playback . stop ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> def test_stop_return_value ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . assertIsNone ( self . playback . stop ( ) . get ( ) ) <EOL> def test_time_position_when_stopped ( self ) : <EOL> self . assertEqual ( self . playback . get_time_position ( ) . get ( ) , <NUM_LIT:0> ) <EOL> @ populate_tracklist <EOL> def test_time_position_when_stopped_with_playlist ( self ) : <EOL> self . assertEqual ( self . playback . get_time_position ( ) . get ( ) , <NUM_LIT:0> ) <EOL> @ unittest . SkipTest <EOL> @ populate_tracklist <EOL> def test_time_position_when_playing ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> first = self . playback . time_position <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> second = self . playback . time_position <EOL> self . assertGreater ( second , first ) <EOL> @ populate_tracklist <EOL> def test_time_position_when_paused ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . pause ( ) . get ( ) <EOL> first = self . playback . get_time_position ( ) . get ( ) <EOL> second = self . playback . get_time_position ( ) . get ( ) <EOL> self . assertEqual ( first , second ) <EOL> @ populate_tracklist <EOL> def test_play_with_consume ( self ) : <EOL> self . tracklist . consume = True <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:0> ] ) <EOL> @ populate_tracklist <EOL> def test_playlist_is_empty_after_all_tracks_are_played_with_consume ( self ) : <EOL> self . tracklist . consume = True <EOL> self . playback . play ( ) . get ( ) <EOL> for t in self . tracks : <EOL> self . trigger_about_to_finish ( ) <EOL> self . assertEqual ( len ( self . tracklist . get_tracks ( ) . get ( ) ) , <NUM_LIT:0> ) <EOL> @ populate_tracklist <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> def test_play_with_random ( self , shuffle_mock ) : <EOL> shuffle_mock . side_effect = lambda tracks : tracks . reverse ( ) <EOL> self . tracklist . random = True <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ - <NUM_LIT:1> ] ) <EOL> @ populate_tracklist <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> def test_previous_with_random ( self , shuffle_mock ) : <EOL> shuffle_mock . side_effect = lambda tracks : tracks . reverse ( ) <EOL> self . tracklist . random = True <EOL> self . playback . play ( ) . get ( ) <EOL> self . playback . next ( ) . get ( ) <EOL> current_track = self . playback . get_current_track ( ) . get ( ) <EOL> self . playback . previous ( ) <EOL> self . assert_current_track_is ( current_track ) <EOL> @ populate_tracklist <EOL> def test_end_of_song_starts_next_track ( self ) : <EOL> self . playback . play ( ) . get ( ) <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:1> ] ) <EOL> @ populate_tracklist <EOL> def test_end_of_song_with_single_and_repeat_starts_same ( self ) : <EOL> self . tracklist . single = True <EOL> self . tracklist . repeat = True <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:0> ] ) <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:0> ] ) <EOL> @ populate_tracklist <EOL> def test_end_of_song_with_single_random_and_repeat_starts_same ( self ) : <EOL> self . tracklist . single = True <EOL> self . tracklist . repeat = True <EOL> self . tracklist . random = True <EOL> self . playback . play ( ) . get ( ) <EOL> current_track = self . playback . get_current_track ( ) . get ( ) <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_current_track_is ( current_track ) <EOL> @ populate_tracklist <EOL> def test_end_of_song_with_single_stops ( self ) : <EOL> self . tracklist . single = True <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_current_track_is ( self . tracks [ <NUM_LIT:0> ] ) <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_current_track_is ( None ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> @ populate_tracklist <EOL> def test_end_of_song_with_single_and_random_stops ( self ) : <EOL> self . tracklist . single = True <EOL> self . tracklist . random = True <EOL> self . playback . play ( ) . get ( ) <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_current_track_is ( None ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> @ populate_tracklist <EOL> def test_end_of_playlist_stops ( self ) : <EOL> self . playback . play ( self . tl_tracks . get ( ) [ - <NUM_LIT:1> ] ) . get ( ) <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> def test_repeat_off_by_default ( self ) : <EOL> self . assertEqual ( self . tracklist . get_repeat ( ) . get ( ) , False ) <EOL> def test_random_off_by_default ( self ) : <EOL> self . assertEqual ( self . tracklist . get_random ( ) . get ( ) , False ) <EOL> def test_consume_off_by_default ( self ) : <EOL> self . assertEqual ( self . tracklist . get_consume ( ) . get ( ) , False ) <EOL> @ populate_tracklist <EOL> def test_random_until_end_of_playlist ( self ) : <EOL> self . tracklist . random = True <EOL> self . playback . play ( ) . get ( ) <EOL> for _ in self . tracks [ <NUM_LIT:1> : ] : <EOL> self . playback . next ( ) . get ( ) <EOL> self . assert_next_tl_track_is ( None ) <EOL> @ populate_tracklist <EOL> def test_random_with_eot_until_end_of_playlist ( self ) : <EOL> self . tracklist . random = True <EOL> self . playback . play ( ) . get ( ) <EOL> for _ in self . tracks [ <NUM_LIT:1> : ] : <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_eot_tl_track_is ( None ) <EOL> @ populate_tracklist <EOL> def test_random_until_end_of_playlist_and_play_from_start ( self ) : <EOL> self . tracklist . random = True <EOL> self . playback . play ( ) . get ( ) <EOL> for _ in self . tracks : <EOL> self . playback . next ( ) . get ( ) <EOL> self . assert_next_tl_track_is_not ( None ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> @ populate_tracklist <EOL> def test_random_with_eot_until_end_of_playlist_and_play_from_start ( self ) : <EOL> self . tracklist . random = True <EOL> self . playback . play ( ) . get ( ) <EOL> for _ in self . tracks : <EOL> self . trigger_about_to_finish ( ) <EOL> self . assert_eot_tl_track_is_not ( None ) <EOL> self . assert_state_is ( PlaybackState . STOPPED ) <EOL> self . playback . play ( ) . get ( ) <EOL> self . assert_state_is ( PlaybackState . PLAYING ) <EOL> @ populate_tracklist <EOL> def test_random_until_end_of_playlist_with_repeat ( self ) : <EOL> self . tracklist . repeat = True <EOL> self . tracklist . random = True <EOL> self . playback . play ( ) . get ( ) <EOL> for _ in self . tracks [ <NUM_LIT:1> : ] : <EOL> self . playback . next ( ) <EOL> self . assert_next_tl_track_is_not ( None ) <EOL> @ populate_tracklist <EOL> def test_played_track_during_random_not_played_again ( self ) : <EOL> self . tracklist . random = True <EOL> self . playback . play ( ) . get ( ) <EOL> played = [ ] <EOL> for _ in self . tracks : <EOL> track = self . playback . get_current_track ( ) . get ( ) <EOL> self . assertNotIn ( track , played ) <EOL> played . append ( track ) <EOL> self . playback . next ( ) . get ( ) <EOL> @ populate_tracklist <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> def test_play_track_then_enable_random ( self , shuffle_mock ) : <EOL> shuffle_mock . side_effect = lambda tracks : tracks . reverse ( ) <EOL> expected = self . tl_tracks . get ( ) [ : : - <NUM_LIT:1> ] + [ None ] <EOL> actual = [ ] <EOL> self . playback . play ( ) . get ( ) <EOL> self . tracklist . random = True <EOL> while self . playback . get_state ( ) . get ( ) != PlaybackState . STOPPED : <EOL> self . playback . next ( ) . get ( ) <EOL> actual . append ( self . playback . get_current_tl_track ( ) . get ( ) ) <EOL> if len ( actual ) > len ( expected ) : <EOL> break <EOL> self . assertEqual ( actual , expected ) <EOL> @ populate_tracklist <EOL> def test_playing_track_that_isnt_in_playlist ( self ) : <EOL> with self . assertRaises ( AssertionError ) : <EOL> self . playback . play ( TlTrack ( <NUM_LIT> , Track ( ) ) ) . get ( ) </s>
