def test_playlist_extension(): pl = Playlist.parse("playlist-extension.xspf") assert pl.extension[0].application == \ "http://localhost/some/valid/url"
def test_playlist_root_name(): with pytest.raises(ValueError): Playlist.parse(get_testfile("playlist-root-name.xspf"))
def test_playlist_namespace_nested_proper(): pl = Playlist.parse('playlist-namespace-nested-proper.xspf') assert pl.extension[0].application == "http://example.com/"
def test_playlist_attribute_forbidden_playlist(): with pytest.raises(TypeError): Playlist.parse( get_testfile('playlist-attribute-forbidden-playlist.xspf'))
def test_playlist_noturi_location(): with pytest.raises(ValueError): Playlist.parse(get_testfile("playlist-noturi-location.xspf"))
def test_playlist_nonleaf_content_attribution(): with pytest.raises(TypeError): Playlist.parse( get_testfile("playlist-nonleaf-content-attribution.xspf"))
def test_playlist_noturi_identifier(): with pytest.raises(ValueError): Playlist.parse(get_testfile("playlist-noturi-identifier.xspf"))
def test_track_empty_annotation(): Playlist.parse("track-empty-creator.xspf")
def test_track_empty_meta(): Playlist.parse("track-empty-meta.xspf")
def test_playlist_empty_creator(): Playlist.parse("playlist-empty-creator.xspf")
def test_track_empty_album(): Playlist.parse("track-empty-album.xspf")
def test_playlist_xml_base(): Playlist.parse("playlist-xml-base.xspf")
def test_playlist_namespace_two_additions(): Playlist.parse("playlist-namespace-two-additions.xspf")
def test_playlist_namespace_nondefault(): Playlist.parse('playlist-namespace-nondefault.xspf')
def test_playlist_namespase_missing(): with pytest.raises(TypeError): Playlist.parse(get_testfile("playlist-namespace-missing.xspf"))
def test_track_empty_title(): Playlist.parse("track-empty-title.xspf")
def test_playlist_namespace_wrong_string(): with pytest.raises(ValueError): Playlist.parse(get_testfile("playlist-namespace-wrong-string.xspf"))
def test_track_extension(): tr = Playlist.parse("track-extension.xspf")[0] assert tr.extension[0].application == "http://localhost/some/valid/url" assert len(tr.extension) == 1 assert len(tr.extension[0].content) == 2
def test_playlist_nonleaf_content_tracklist(): with pytest.raises(TypeError): Playlist.parse(get_testfile("playlist-nonleaf-content-trackList.xspf"))
def test_track_whitespace_int(): pl = Playlist.parse("track-whitespace-nonNegativeInteger.xspf") for i in range(4): assert pl[i].duration == 1
def test_playlist_noturi_image(): with pytest.raises(ValueError): Playlist.parse(get_testfile("playlist-noturi-image.xspf"))
def test_track_whitespace_nonNegativeInteger(): pl = Playlist.parse("track-whitespace-nonNegativeInteger.xspf") assert len(pl) == 4 for tr in pl: assert tr.duration == 1
def test_playlist_noturi_link_rel(): with pytest.raises(ValueError): Playlist.parse(get_testfile("playlist-noturi-link-rel.xspf"))
def test_playlist_empty_title(): Playlist.parse("playlist-empty-title.xspf")
def test_playlist_noturi_meta(): with pytest.raises(ValueError): Playlist.parse(get_testfile("playlist-noturi-meta.xspf"))
def test_playlist_empty_meta(): Playlist.parse("playlist-empty-meta.xspf")
def test_playlist_toomany_annotation(): with pytest.raises(TypeError): Playlist.parse(get_testfile("playlist-toomany-annotation.xspf"))
def test_playlist_empty_annotation(): Playlist.parse("playlist-empty-annotation.xspf")