bazwilliams / openhomedevice

Python library to access services on Linn Ds and other Openhome devices
MIT License
7 stars 3 forks source link

Test failures with async-upnp-client 0.40.0 #23

Closed mweinelt closed 1 month ago

mweinelt commented 1 month ago

Hi,

after upgrading async-upnp-client from 0.39.0 to 0.40.0 the following tests started failing:

openhomedevice> _______________________ TrackInfoParserTests.test_three ________________________
openhomedevice> 
openhomedevice> self = <TrackInfoParserTest.TrackInfoParserTests testMethod=test_three>
openhomedevice> 
openhomedevice>     def test_three(self):
openhomedevice>         element_string = '<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="d5112915403826242371-co533" parentID="co533" restricted="0"><dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">The Mystic Trumpeter, Op. 18 - Colin Matthews & Imogen Holst</dc:title><upnp:class xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">object.item.audioItem.musicTrack</upnp:class><upnp:albumArtURI xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">http://192.168.1.126:9790/minimserver/*/music/Albums/RSNO*20-*20Holst*20-*20The*20Planets,*20The*20Mystic*20Trumpeter/09*20The*20Mystic*20Trumpeter,*20Op.*2018*20-*20Colin*20Matthews*20*26*20Imogen*20Holst.mp3/$!picture-633-144623.jpg</upnp:albumArtURI><upnp:album xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">Holst: The Planets, The Mystic Trumpeter</upnp:album><upnp:artist xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">Royal Scottish National Orchestra; David Lloyd-Jones</upnp:artist><upnp:artist role="AlbumArtist" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">Royal Scottish National Orchestra; David Lloyd-Jones</upnp:artist><dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2001-01-01</dc:date><upnp:genre xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">Classical</upnp:genre><upnp:genre xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">Orchestral</upnp:genre><res sampleFrequency="44100" bitrate="24000">http://192.168.1.126:9790/minimserver/*/music/Albums/RSNO*20-*20Holst*20-*20The*20Planets,*20The*20Mystic*20Trumpeter/09*20The*20Mystic*20Trumpeter,*20Op.*2018*20-*20Colin*20Matthews*20*26*20Imogen*20Holst.mp3</res></item></DIDL-Lite>'
openhomedevice>         result = self.sut(element_string)
openhomedevice> >       self.assertEqual(result.get("type"), "object.item.audioItem.musicTrack")
openhomedevice> E       AssertionError: None != 'object.item.audioItem.musicTrack'
openhomedevice> 
openhomedevice> tests/TrackInfoParserTest.py:100: AssertionError
openhomedevice> ________________________ TrackInfoParserTests.test_two _________________________
openhomedevice> 
openhomedevice> self = <TrackInfoParserTest.TrackInfoParserTests testMethod=test_two>
openhomedevice> 
openhomedevice>     def test_two(self):
openhomedevice>         element_string = '<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="" parentID="" restricted="True"><dc:title>BBC Radio 6 Music (AAA)</dc:title><res protocolInfo="*:*:*:*" bitrate="40000">http://opml.radiotime.com/Tune.ashx?id=s44491&formats=mp3,wma,aac,ogg,hls&partnerId=ah2rjr68&username=bazwilliams&c=ebrowse</res><upnp:albumArtURI>http://cdn-radiotime-logos.tunein.com/s44491q.png</upnp:albumArtURI><upnp:class>object.item.audioItem</upnp:class></item></DIDL-Lite>'
openhomedevice>         result = self.sut(element_string)
openhomedevice> >       self.assertEqual(result.get("type"), "object.item.audioItem")
openhomedevice> E       AssertionError: None != 'object.item.audioItem'
openhomedevice> 
openhomedevice> tests/TrackInfoParserTest.py:63: AssertionError
bazwilliams commented 1 month ago

Thanks for raising.

I see the same and am not sure how this is caused by upgrading async-upnp-client as I handrolled my own DIDL-Lite parser (which is clearly broken now) which doesn't use that library.

Longer term I want to migrate to https://github.com/StevenLooman/python-didl-lite - but will see what needs to be sorted now.

bazwilliams commented 1 month ago

When I fixed an escaping issue, I failed to commit changes to test data which required unescaping. Now fixed in https://github.com/bazwilliams/openhomedevice/releases/tag/2.3.1