def test_parse_retrieves_title_and_path(self): playlist = M3u.parse(StringIO(ONE_TRACK_PL)) assert_that(list(playlist), is_([(TITLE, PATH)]))
def test_parse_parses_more_than_one_track(self): playlist = M3u.parse(StringIO(SEVERAL_TRACKS_PL)) assert_that(playlist, has_len(2))
def test_parse_parses_playlists(self): playlist = M3u.parse(StringIO(ONE_TRACK_PL)) assert_that(playlist, has_len(1))
def test_parse_takes_empty_playlists(self): playlist = M3u.parse(StringIO(EMPTY_PL)) assert_that(playlist, is_(empty()))
def test_parse_raises_parse_error_on_wrong_headers(self): with assert_that_raises(M3uError): list(M3u.parse(StringIO('foo')))
def test_parse_raises_parse_error_on_empty_sources(self): with assert_that_raises(M3uError): list(M3u.parse(StringIO()))
def test_parse_takes_file_like_objects(self): list(M3u.parse(StringIO(EMPTY_PL)))