def test_clear_playlist_nonexistent(capfd):
    player = VideoPlayer()
    player.clear_playlist("my_cool_playlist")
    out, err = capfd.readouterr()
    lines = out.splitlines()
    assert len(lines) == 1
    assert "Cannot clear playlist my_cool_playlist: Playlist does not exist" in lines[0]
def test_clear_playlist(capfd):
    player = VideoPlayer()
    player.create_playlist("my_cool_playlist")
    player.add_to_playlist("my_cool_playlist", "amazing_cats_video_id")
    player.show_playlist("my_cool_playlist")
    player.clear_playlist("my_COOL_playlist")
    player.show_playlist("my_cool_playlist")
    out, err = capfd.readouterr()
    lines = out.splitlines()
    assert len(lines) == 7
    assert "Successfully created new playlist: my_cool_playlist" in lines[0]
    assert "Added video to my_cool_playlist: Amazing Cats" in lines[1]
    assert "Showing playlist: my_cool_playlist" in lines[2]
    assert "Amazing Cats (amazing_cats_video_id) [#cat #animal]" in lines[3]
    assert "Successfully removed all videos from my_COOL_playlist" in lines[4]
    assert "Showing playlist: my_cool_playlist" in lines[5]
    assert "No videos here yet" in lines[6]