@populate_tracklist
    @mock.patch('random.shuffle')
    def test_play_track_then_enable_random(self, shuffle_mock):
        # Covers underlying issue IssueGH17RegressionTest tests for.
        shuffle_mock.side_effect = lambda tracks: tracks.reverse()

        expected = self.tl_tracks.get()[::-1] + [None]
        actual = []

        self.playback.play().get()
        self.tracklist.random = True
        while self.playback.get_state().get() != PlaybackState.STOPPED:
            self.playback.next().get()
            actual.append(self.playback.get_current_tl_track().get())
            if len(actual) > len(expected):
                break
        self.assertEqual(actual, expected)
dataset/ETHPy150Open mopidy/mopidy/tests/local/test_playback.py/LocalPlaybackProviderTest.test_play_track_then_enable_random/original