

def test_searchaddpl_creates_missing_playlist(self):
    self.backend.library.dummy_search_result = SearchResult(tracks=[Track(uri='dummy:a', name='A')])
    playlists = self.core.playlists.as_list().get()
    self.assertNotIn('my favs', {p.name for p in playlists})
    self.send_request('searchaddpl "my favs" "title" "a"')
    playlists = self.core.playlists.as_list().get()
    playlist = {p.name: p for p in playlists}['my favs']
    items = self.core.playlists.get_items(playlists.uri).get()
    self.assertEqual(len(items), 1)
    self.assertEqual(items[0].uri, 'dummy:a')
    self.assertInResponse('OK')

dataset/ETHPy150Open mopidy/mopidy/tests/mpd/protocol/test_music_db.py MusicDatabaseHandlerTest.test_searchaddpl_creates_missing_playlist/VarMisuse@119/177 `playlist`->`playlists`