<s> import unittest <EOL> import os <EOL> import sys <EOL> sys . path . append ( os . path . abspath ( "<STR_LIT:..>" ) ) <EOL> import xspf <EOL> class XspfTest ( unittest . TestCase ) : <EOL> def testBySpiff ( self ) : <EOL> x = xspf . Spiff ( ) <EOL> self . assertTrue ( isinstance ( x , xspf . Xspf ) ) <EOL> def testEmptyPlaylist ( self ) : <EOL> x = xspf . Xspf ( ) <EOL> expected = b"""<STR_LIT>""" <EOL> self . assertEqual ( expected , x . toXml ( pretty_print = False ) ) <EOL> def testTitle ( self ) : <EOL> x = xspf . Xspf ( ) <EOL> x . title = "<STR_LIT:title>" <EOL> expected = b"""<STR_LIT>""" <EOL> self . assertEqual ( expected , x . toXml ( pretty_print = False ) ) <EOL> def testCreator ( self ) : <EOL> x = xspf . Xspf ( ) <EOL> x . creator = "<STR_LIT>" <EOL> expected = b"""<STR_LIT>""" <EOL> self . assertEqual ( expected , x . toXml ( pretty_print = False ) ) <EOL> def testAnnotation ( self ) : <EOL> x = xspf . Xspf ( ) <EOL> x . annotation = "<STR_LIT>" <EOL> expected = b"""<STR_LIT>""" <EOL> self . assertEqual ( expected , x . toXml ( pretty_print = False ) ) <EOL> def testInfo ( self ) : <EOL> x = xspf . Xspf ( ) <EOL> x . info = "<STR_LIT:info>" <EOL> expected = b"""<STR_LIT>""" <EOL> self . assertEqual ( expected , x . toXml ( pretty_print = False ) ) <EOL> def testLocation ( self ) : <EOL> x = xspf . Xspf ( ) <EOL> x . location = "<STR_LIT>" <EOL> expected = b"""<STR_LIT>""" <EOL> self . assertEqual ( expected , x . toXml ( pretty_print = False ) ) <EOL> def testIdentifier ( self ) : <EOL> x = xspf . Xspf ( ) <EOL> x . identifier = "<STR_LIT:id>" <EOL> expected = b"""<STR_LIT>""" <EOL> self . assertEqual ( expected , x . toXml ( pretty_print = False ) ) <EOL> def testImage ( self ) : <EOL> x = xspf . Xspf ( ) <EOL> x . image = "<STR_LIT:image>" <EOL> expected = b"""<STR_LIT>""" <EOL> self . assertEqual ( expected , x . toXml ( pretty_print = False ) ) <EOL> def testDate ( self ) : <EOL> x = xspf . Xspf ( ) <EOL> x . date = "<STR_LIT:date>" <EOL> expected = b"""<STR_LIT>""" <EOL> self . assertEqual ( expected , x . toXml ( pretty_print = False ) ) <EOL> def testLicense ( self ) : <EOL> x = xspf . Xspf ( ) <EOL> x . license = "<STR_LIT>" <EOL> expected = b"""<STR_LIT>""" <EOL> self . assertEqual ( expected , x . toXml ( pretty_print = False ) ) <EOL> def testKwargs ( self ) : <EOL> """<STR_LIT>""" <EOL> x = xspf . Xspf ( title = "<STR_LIT>" <EOL> , creator = "<STR_LIT>" <EOL> , info = "<STR_LIT:info>" <EOL> , annotation = "<STR_LIT>" <EOL> , location = "<STR_LIT:location>" <EOL> , identifier = "<STR_LIT:id>" <EOL> , image = "<STR_LIT:image>" <EOL> , date = "<STR_LIT:date>" <EOL> , license = "<STR_LIT>" ) <EOL> self . assertEqual ( "<STR_LIT>" , x . title ) <EOL> self . assertEqual ( "<STR_LIT>" , x . creator ) <EOL> self . assertEqual ( "<STR_LIT:info>" , x . info ) <EOL> self . assertEqual ( "<STR_LIT>" , x . annotation ) <EOL> self . assertEqual ( "<STR_LIT:location>" , x . location ) <EOL> self . assertEqual ( "<STR_LIT:id>" , x . identifier ) <EOL> self . assertEqual ( "<STR_LIT:image>" , x . image ) <EOL> self . assertEqual ( "<STR_LIT:date>" , x . date ) <EOL> self . assertEqual ( "<STR_LIT>" , x . license ) <EOL> def testDict ( self ) : <EOL> """<STR_LIT>""" <EOL> x = xspf . Xspf ( { "<STR_LIT:title>" : "<STR_LIT>" , "<STR_LIT>" : "<STR_LIT>" } ) <EOL> self . assertEqual ( "<STR_LIT>" , x . title ) <EOL> self . assertEqual ( "<STR_LIT>" , x . creator ) <EOL> def testDictTracks ( self ) : <EOL> """<STR_LIT>""" <EOL> x = xspf . Xspf ( { "<STR_LIT:title>" : "<STR_LIT>" , "<STR_LIT>" : [ { "<STR_LIT:title>" : "<STR_LIT>" } , { "<STR_LIT:title>" : "<STR_LIT>" } ] } ) <EOL> self . assertEqual ( "<STR_LIT>" , x . title ) <EOL> self . assertEqual ( <NUM_LIT:2> , len ( x . track ) ) <EOL> self . assertEqual ( "<STR_LIT>" , x . track [ <NUM_LIT:0> ] . title ) <EOL> self . assertEqual ( "<STR_LIT>" , x . track [ <NUM_LIT:1> ] . title ) <EOL> def testXspfParser ( self ) : <EOL> """<STR_LIT>""" <EOL> parse = { "<STR_LIT>" : { "<STR_LIT:title>" : "<STR_LIT>" } } <EOL> x = xspf . Xspf ( parse ) <EOL> self . assertEqual ( "<STR_LIT>" , x . title ) <EOL> def testMeta ( self ) : <EOL> """<STR_LIT>""" <EOL> x = xspf . Xspf ( ) <EOL> x . add_meta ( "<STR_LIT:key>" , "<STR_LIT:value>" ) <EOL> expected = b"""<STR_LIT>""" <EOL> self . assertEqual ( expected , x . toXml ( pretty_print = False ) ) <EOL> x . add_meta ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> expected = b"""<STR_LIT>""" <EOL> self . assertEqual ( expected , x . toXml ( pretty_print = False ) ) <EOL> m = x . meta <EOL> self . assertEqual ( "<STR_LIT:value>" , m [ "<STR_LIT:key>" ] ) <EOL> self . assertEqual ( "<STR_LIT>" , m [ "<STR_LIT>" ] ) <EOL> x . del_meta ( "<STR_LIT:key>" ) <EOL> expected = b"""<STR_LIT>""" <EOL> self . assertEqual ( expected , x . toXml ( pretty_print = False ) ) <EOL> def testLink ( self ) : <EOL> """<STR_LIT>""" <EOL> x = xspf . Xspf ( ) <EOL> x . add_link ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> expected = b"""<STR_LIT>""" <EOL> self . assertEqual ( expected , x . toXml ( pretty_print = False ) ) </s>
