def test_parse_fills_missing_fields_with_none(self): playlist = Asx.parse(StringIO(MISSING_TITLE_PL)) track = list(playlist)[0] assert_that(track[0], is_(none()))
def test_parse_retrieves_title_and_path(self): playlist = Asx.parse(StringIO(ONE_TRACK_PL)) assert_that(list(playlist), is_([(TITLE, PATH)]))
def test_parse_retrieves_path_without_file_prefix(self): playlist = Asx.parse(StringIO(ONE_TRACK_PL)) track = list(playlist)[0] assert_that(track[1], does_not(starts_with('file://')))
def test_parse_parses_playlists(self): playlist = Asx.parse(StringIO(ONE_TRACK_PL)) assert_that(playlist, has_len(1))
def test_parse_takes_empty_playlists(self): playlist = Asx.parse(StringIO(EMPTY_PL)) assert_that(playlist, is_(empty()))
def test_parse_raises_parse_error_on_empty_documents(self): with assert_that_raises(AsxError): list(Asx.parse(StringIO()))
def test_parse_takes_file_like_objects(self): Asx.parse(StringIO(u'<element/>'))
def test_parse_parses_more_than_one_track(self): playlist = Asx.parse(StringIO(SEVERAL_TRACKS_PL)) assert_that(playlist, has_len(2))