Improved README #140
3 fail, 31 pass in 1s
Annotations
Check warning on line 0 in tests.unit.media_backend_util_test.Tests
github-actions / Tests results
test_parse_list (tests.unit.media_backend_util_test.Tests) failed
junit/test-results.xml [took 0s]
Raw output
xsdata.exceptions.ParserError: Namespace prefix xsi for type on mediaUpdate is not defined, line 1, column 147 (<string>, line 1)
self = XmlParser(config=<xsdata.formats.dataclass.parsers.config.ParserConfig object at 0x7f27b053cb20>, context=<xsdata.form...bject at 0x7f27b0571180>, handler=<class 'xsdata.formats.dataclass.parsers.handlers.lxml.LxmlEventHandler'>, ns_map={})
source = <_io.BytesIO object at 0x7f27afcdf7e0>, clazz = None
def parse(self, source: Any, clazz: Optional[Type[T]] = None) -> T:
"""Parse the input stream or filename and return the resulting object
tree."""
handler = self.handler(clazz=clazz, parser=self)
with warnings.catch_warnings():
if self.config.fail_on_converter_warnings:
warnings.filterwarnings("error", category=ConverterWarning)
try:
> result = handler.parse(source)
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/xsdata/formats/dataclass/parsers/bases.py:54:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xsdata.formats.dataclass.parsers.handlers.lxml.LxmlEventHandler object at 0x7f27afd070c0>
source = <_io.BytesIO object at 0x7f27afcdf7e0>
def parse(self, source: Any) -> Any:
"""
Parse an XML document from a system identifier or an InputSource or
directly from a lxml Element or Tree.
When Source is a lxml Element or Tree the handler will switch to
the :class:`lxml.etree.iterwalk` api.
When source is a system identifier or an InputSource the parser
will ignore comments and recover from errors.
When config process_xinclude is enabled the handler will parse
the whole document and then walk down the element tree.
"""
if isinstance(source, (etree._ElementTree, etree._Element)):
ctx = etree.iterwalk(source, EVENTS)
elif self.parser.config.process_xinclude:
> tree = etree.parse(source, base_url=self.parser.config.base_url) # nosec
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/xsdata/formats/dataclass/parsers/handlers/lxml.py:40:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
src/lxml/etree.pyx:3541:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
src/lxml/parser.pxi:1896:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
src/lxml/parser.pxi:1916:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
src/lxml/parser.pxi:1803:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
src/lxml/parser.pxi:1144:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
src/lxml/parser.pxi:618:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
src/lxml/parser.pxi:728:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E File "<string>", line 1
E lxml.etree.XMLSyntaxError: Namespace prefix xsi for type on mediaUpdate is not defined, line 1, column 147
src/lxml/parser.pxi:657: XMLSyntaxError
During handling of the above exception, another exception occurred:
self = <tests.unit.media_backend_util_test.Tests testMethod=test_parse_list>
def test_parse_list(self):
xml = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?><list xmlns="urn:vpro:media:update:2009" xmlns:media="urn:vpro:media:2009" xmlns:shared="urn:vpro:shared:2009" offset="0" totalCount="5" max="200" order="ASC" size="5"><item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="memberUpdateType" position="1" highlighted="false"><mediaUpdate xsi:type="programUpdateType" type="TRACK" avType="AUDIO" embeddable="true" mid="WO_VPRO_422840" urn="urn:vpro:media:program:31357971"><broadcaster>VPRO</broadcaster><title type="MAIN">Sweaty Fingers</title><duration>P0DT0H11M53.000S</duration><memberOf position="1" highlighted="false">WO_S_VPRO_422849</memberOf><locations><location urn="urn:vpro:media:location:31357975"><programUrl>odis+http://content.omroep.nl/vpro/protected/luisterpaal/albums/world/WO_S_VPRO_422849/track01.mp3</programUrl><avAttributes><bitrate>112</bitrate><avFileFormat>MP3</avFileFormat><audioAttributes><channels>2</channels><coding>MP3</coding></audioAttributes></avAttributes><duration>P0DT0H11M53.000S</duration></location></locations><scheduleEvents/><relation type="ARTIST" broadcaster="VPRO" urn="urn:vpro:media:relation:31357976">Cave</relation><images><image type="PICTURE" highlighted="false"><title>Cave - Threace</title><description>Cover image</description><urn>urn:vpro:image:236672</urn></image></images><segments/></mediaUpdate></item><item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="memberUpdateType" position="2" highlighted="false"><mediaUpdate xsi:type="programUpdateType" type="TRACK" avType="AUDIO" embeddable="true" mid="WO_VPRO_422839" urn="urn:vpro:media:program:31357951"><broadcaster>VPRO</broadcaster><title type="MAIN">Silver Headband</title><duration>P0DT0H8M53.000S</duration><memberOf position="2" highlighted="false">WO_S_VPRO_422849</memberOf><locations><location urn="urn:vpro:media:location:31357955"><programUrl>odis+http://content.omroep.nl/vpro/protected/luisterpaal/albums/world/WO_S_VPRO_422849/track02.mp3</programUrl><avAttributes><bitrate>112</bitrate><avFileFormat>MP3</avFileFormat><audioAttributes><channels>2</channels><coding>MP3</coding></audioAttributes></avAttributes><duration>P0DT0H8M53.000S</duration></location></locations><scheduleEvents/><relation type="ARTIST" broadcaster="VPRO" urn="urn:vpro:media:relation:31357956">Cave</relation><images><image type="PICTURE" highlighted="false"><title>Cave - Threace</title><description>Cover image</description><urn>urn:vpro:image:236672</urn></image></images><segments/></mediaUpdate></item><item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="memberUpdateType" position="3" highlighted="false"><mediaUpdate xsi:type="programUpdateType" type="TRACK" avType="AUDIO" embeddable="true" mid="WO_VPRO_422842" urn="urn:vpro:media:program:31357990"><broadcaster>VPRO</broadcaster><title type="MAIN">Arrow\'s Myth</title><duration>P0DT0H8M49.000S</duration><memberOf position="3" highlighted="false">WO_S_VPRO_422849</memberOf><locations><location urn="urn:vpro:media:location:31357994"><programUrl>odis+http://content.omroep.nl/vpro/protected/luisterpaal/albums/world/WO_S_VPRO_422849/track03.mp3</programUrl><avAttributes><bitrate>112</bitrate><avFileFormat>MP3</avFileFormat><audioAttributes><channels>2</channels><coding>MP3</coding></audioAttributes></avAttributes><duration>P0DT0H8M49.000S</duration></location></locations><scheduleEvents/><relation type="ARTIST" broadcaster="VPRO" urn="urn:vpro:media:relation:31357995">Cave</relation><images><image type="PICTURE" highlighted="false"><title>Cave - Threace</title><description>Cover image</description><urn>urn:vpro:image:236672</urn></image></images><segments/></mediaUpdate></item><item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="memberUpdateType" position="4" highlighted="false"><mediaUpdate xsi:type="programUpdateType" type="TRACK" avType="AUDIO" embeddable="true" mid="WO_VPRO_422843" urn="urn:vpro:media:program:31357998"><broadcaster>VPRO</broadcaster><title type="MAIN">Shikaakwa</title><duration>P0DT0H5M2.000S</duration><memberOf position="4" highlighted="false">WO_S_VPRO_422849</memberOf><locations><location urn="urn:vpro:media:location:31358002"><programUrl>odis+http://content.omroep.nl/vpro/protected/luisterpaal/albums/world/WO_S_VPRO_422849/track04.mp3</programUrl><avAttributes><bitrate>112</bitrate><avFileFormat>MP3</avFileFormat><audioAttributes><channels>2</channels><coding>MP3</coding></audioAttributes></avAttributes><duration>P0DT0H5M2.000S</duration></location></locations><scheduleEvents/><relation type="ARTIST" broadcaster="VPRO" urn="urn:vpro:media:relation:31358003">Cave</relation><images><image type="PICTURE" highlighted="false"><title>Cave - Threace</title><description>Cover image</description><urn>urn:vpro:image:236672</urn></image></images><segments/></mediaUpdate></item><item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="memberUpdateType" position="5" highlighted="false"><mediaUpdate xsi:type="programUpdateType" type="TRACK" avType="AUDIO" embeddable="true" mid="WO_VPRO_422841" urn="urn:vpro:media:program:31357982"><broadcaster>VPRO</broadcaster><title type="MAIN">Slow Bern</title><duration>P0DT0H7M14.000S</duration><memberOf position="5" highlighted="false">WO_S_VPRO_422849</memberOf><locations><location urn="urn:vpro:media:location:31357986"><programUrl>odis+http://content.omroep.nl/vpro/protected/luisterpaal/albums/world/WO_S_VPRO_422849/track05.mp3</programUrl><avAttributes><bitrate>112</bitrate><avFileFormat>MP3</avFileFormat><audioAttributes><channels>2</channels><coding>MP3</coding></audioAttributes></avAttributes><duration>P0DT0H7M14.000S</duration></location></locations><scheduleEvents/><relation type="ARTIST" broadcaster="VPRO" urn="urn:vpro:media:relation:31357987">Cave</relation><images><image type="PICTURE" highlighted="false"><title>Cave - Threace</title><description>Cover image</description><urn>urn:vpro:image:236672</urn></image></images><segments/></mediaUpdate></item></list>"""
> mapped = list(MU.iterate_objects(xml))
tests/unit/media_backend_util_test.py:41:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/npoapi/media_backend_util.py:327: in <lambda>
result = map(lambda m: MediaBackendUtil.map_member(m, binding), members)
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/npoapi/media_backend_util.py:338: in map_member
return npoapi.utils.to_object(update, binding=binding, clazz=MediaUpdateType)
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/npoapi/utils.py:83: in to_object
result = poms.from_bytes(bytes)
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/npoapi/data/poms.py:78: in from_bytes
return parser.from_bytes(source)
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/xsdata/formats/bindings.py:29: in from_bytes
return self.parse(io.BytesIO(source), clazz)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = XmlParser(config=<xsdata.formats.dataclass.parsers.config.ParserConfig object at 0x7f27b053cb20>, context=<xsdata.form...bject at 0x7f27b0571180>, handler=<class 'xsdata.formats.dataclass.parsers.handlers.lxml.LxmlEventHandler'>, ns_map={})
source = <_io.BytesIO object at 0x7f27afcdf7e0>, clazz = None
def parse(self, source: Any, clazz: Optional[Type[T]] = None) -> T:
"""Parse the input stream or filename and return the resulting object
tree."""
handler = self.handler(clazz=clazz, parser=self)
with warnings.catch_warnings():
if self.config.fail_on_converter_warnings:
warnings.filterwarnings("error", category=ConverterWarning)
try:
result = handler.parse(source)
except (ConverterWarning, SyntaxError) as e:
> raise ParserError(e)
E xsdata.exceptions.ParserError: Namespace prefix xsi for type on mediaUpdate is not defined, line 1, column 147 (<string>, line 1)
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/xsdata/formats/dataclass/parsers/bases.py:56: ParserError
Check warning on line 0 in tests.unit.media_backend_util_test.Tests
github-actions / Tests results
test_segments_as_members (tests.unit.media_backend_util_test.Tests) failed
junit/test-results.xml [took 0s]
Raw output
xsdata.exceptions.ParserError: Namespace prefix xsi for type on mediaUpdate is not defined, line 1, column 158 (<string>, line 1)
self = XmlParser(config=<xsdata.formats.dataclass.parsers.config.ParserConfig object at 0x7f27b053cb20>, context=<xsdata.form...bject at 0x7f27b0571180>, handler=<class 'xsdata.formats.dataclass.parsers.handlers.lxml.LxmlEventHandler'>, ns_map={})
source = <_io.BytesIO object at 0x7f27afd335b0>, clazz = None
def parse(self, source: Any, clazz: Optional[Type[T]] = None) -> T:
"""Parse the input stream or filename and return the resulting object
tree."""
handler = self.handler(clazz=clazz, parser=self)
with warnings.catch_warnings():
if self.config.fail_on_converter_warnings:
warnings.filterwarnings("error", category=ConverterWarning)
try:
> result = handler.parse(source)
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/xsdata/formats/dataclass/parsers/bases.py:54:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xsdata.formats.dataclass.parsers.handlers.lxml.LxmlEventHandler object at 0x7f27afc733c0>
source = <_io.BytesIO object at 0x7f27afd335b0>
def parse(self, source: Any) -> Any:
"""
Parse an XML document from a system identifier or an InputSource or
directly from a lxml Element or Tree.
When Source is a lxml Element or Tree the handler will switch to
the :class:`lxml.etree.iterwalk` api.
When source is a system identifier or an InputSource the parser
will ignore comments and recover from errors.
When config process_xinclude is enabled the handler will parse
the whole document and then walk down the element tree.
"""
if isinstance(source, (etree._ElementTree, etree._Element)):
ctx = etree.iterwalk(source, EVENTS)
elif self.parser.config.process_xinclude:
> tree = etree.parse(source, base_url=self.parser.config.base_url) # nosec
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/xsdata/formats/dataclass/parsers/handlers/lxml.py:40:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
src/lxml/etree.pyx:3541:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
src/lxml/parser.pxi:1896:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
src/lxml/parser.pxi:1916:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
src/lxml/parser.pxi:1803:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
src/lxml/parser.pxi:1144:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
src/lxml/parser.pxi:618:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
src/lxml/parser.pxi:728:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E File "<string>", line 1
E lxml.etree.XMLSyntaxError: Namespace prefix xsi for type on mediaUpdate is not defined, line 1, column 158
src/lxml/parser.pxi:657: XMLSyntaxError
During handling of the above exception, another exception occurred:
self = <tests.unit.media_backend_util_test.Tests testMethod=test_segments_as_members>
def test_segments_as_members(self):
xml = """
<program xmlns="urn:vpro:media:update:2009" xmlns:media="urn:vpro:media:2009" xmlns:shared="urn:vpro:shared:2009" type="BROADCAST" avType="AUDIO" embeddable="true" mid="RBX_NOS_703622" urn="urn:vpro:media:program:47853525">
<crid>crid://broadcast.radiobox2/309347</crid>
<broadcaster>NOS</broadcaster>
<title type="MAIN">NOS-Radio 1-Journaal</title>
<description type="MAIN">Nieuws en actualiteiten.</description>
<locations/>
<scheduleEvents>
<scheduleEvent channel="RAD1">
<start>2015-04-22T06:00:00.000+02:00</start>
<duration>P0DT3H0M0.000S</duration>
</scheduleEvent>
</scheduleEvents>
<images/>
<episodeOf position="1" highlighted="false">RBX_S_NOS_553954</episodeOf>
<segments>
<segment midRef="RBX_NOS_703622" avType="AUDIO" embeddable="true" mid="RBX_NOS_839624" urn="urn:vpro:media:segment:54408153">
<crid>crid://audiofragment.radiobox2/182587</crid>
<broadcaster>NOS</broadcaster>
<title type="MAIN">Actievoerende agenten rijden langzaam op snelweg</title>
<description type="MAIN">
In Groningen is de landelijke politieactie op de snelwegen begonnen. Politiewagens rijden met 60 kilometer per uur over de volle breedte van snelwegen naar het zuiden. De actie eindigt vanavond in Maastricht. Onderweg sluiten andere agenten zich vanuit het hele land bij de actie aan.De politie houdt de langzaamaanacties om aandacht te vragen voor het cao-conflict met minister Van der Steur. De agenten willen onder meer een hoger salaris. Vorige maand hielden ze al een sireneprotest.VertragingDe estafetteactie van vandaag gaat tot ongeveer 20.00 uur duren. Dan komen de laatste politiewagens in Maastricht aan.Rijkswaterstaat verwacht dat de langzaam rijdende wagens veel vertraging veroorzaken, vooral in de middag bij Rotterdam en tijdens de avondspits in Noord-Brabant.
</description>
<duration>P0DT0H3M14.000S</duration>
<locations/>
<scheduleEvents/>
<images/>
<start>P0DT0H12M44.000S</start>
</segment>
<segment midRef="RBX_NOS_703622" avType="AUDIO" embeddable="true" mid="RBX_NOS_839600" urn="urn:vpro:media:segment:54407864">
<crid>crid://audiofragment.radiobox2/182585</crid>
<broadcaster>NOS</broadcaster>
<title type="MAIN">Saudi-Arabië begint 'nieuwe fase' in Jemen</title>
<description type="MAIN">
Saudi-Arabië heeft de bombardementscampagne 'Vastbesloten Storm' in Jemen voor beëindigd verklaard. De militaire doelen van die campagne zijn bereikt, zegt de regering in Riyad. Tegelijkertijd begint een nieuwe operatie in Jemen, die de naam 'Herstel van Hoop' krijgt.Daarbij gaat het volgens het Saudische ministerie van Defensie om het regelen van evacuaties in Jemen, het voorkomen van terreinwinst van de Houthi's en de bescherming van burgers.Koning SalmanEerder vandaag maakte de Saudische koning Salman bekend dat hij de Nationale Garde in zijn land opdracht heeft gegeven deel te nemen aan de strijd in het buurland Jemen. De nationale garde staat onder rechtstreeks bevel van het Saudische koningshuis. De gardisten staan al aan de grens opgesteld. Een invasie wordt echter onwaarschijnlijk geacht.Bijna een maand heeft de Saudische luchtmacht doelen in Jemen gebombardeerd. De Saudi's kwamen in actie naar aanleiding van de opmars van Houthi-rebellen in Jemen. Die hadden de macht in de hoofdstad Sanaa al maanden geleden overgenomen en stonden op het punt ook de zuidelijke havenstad Aden in te nemen.Bij de bombardementen zijn honderden doden gevallen. Vandaag melden artsen in Jemen veertig doden bij twee aanvallen. Gisteren vielen zeker twintig doden bij Saudische luchtaanvallen.
</description>
<tag>Jemen</tag>
<duration>P0DT0H4M13.000S</duration>
<locations/>
<scheduleEvents/>
<images/>
<start>P0DT1H8M1.000S</start>
</segment>
<segment midRef="RBX_NOS_703622" avType="AUDIO" embeddable="true" mid="RBX_NOS_839602" urn="urn:vpro:media:segment:54408053">
<crid>crid://audiofragment.radiobox2/182586</crid>
<broadcaster>NOS</broadcaster>
<title type="MAIN">Nationale Ik Stap Over Van Bank week</title>
<description type="MAIN">
Het rommelt in banken-land. Na de flinke salarisverhogingen voor de top van ING en ABN Amro, blijkt dat steeds meer mensen een andere bank zoeken. En dan is het ook nog de: 'Ik stap over van Bank week'. Bijna 4.000 mensen hebben deze week gezegd over te stappen. Bert van Slooten dook in de wereld van de overstappers
</description>
<duration>P0DT0H2M49.000S</duration>
<locations/>
<scheduleEvents/>
<images/>
<start>P0DT1H20M40.000S</start>
</segment>
</segments>
</program>
"""
> print(list((MU.iterate_objects(MU.segments_as_members(xml)))))
tests/unit/media_backend_util_test.py:112:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/npoapi/media_backend_util.py:327: in <lambda>
result = map(lambda m: MediaBackendUtil.map_member(m, binding), members)
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/npoapi/media_backend_util.py:338: in map_member
return npoapi.utils.to_object(update, binding=binding, clazz=MediaUpdateType)
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/npoapi/utils.py:83: in to_object
result = poms.from_bytes(bytes)
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/npoapi/data/poms.py:78: in from_bytes
return parser.from_bytes(source)
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/xsdata/formats/bindings.py:29: in from_bytes
return self.parse(io.BytesIO(source), clazz)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = XmlParser(config=<xsdata.formats.dataclass.parsers.config.ParserConfig object at 0x7f27b053cb20>, context=<xsdata.form...bject at 0x7f27b0571180>, handler=<class 'xsdata.formats.dataclass.parsers.handlers.lxml.LxmlEventHandler'>, ns_map={})
source = <_io.BytesIO object at 0x7f27afd335b0>, clazz = None
def parse(self, source: Any, clazz: Optional[Type[T]] = None) -> T:
"""Parse the input stream or filename and return the resulting object
tree."""
handler = self.handler(clazz=clazz, parser=self)
with warnings.catch_warnings():
if self.config.fail_on_converter_warnings:
warnings.filterwarnings("error", category=ConverterWarning)
try:
result = handler.parse(source)
except (ConverterWarning, SyntaxError) as e:
> raise ParserError(e)
E xsdata.exceptions.ParserError: Namespace prefix xsi for type on mediaUpdate is not defined, line 1, column 158 (<string>, line 1)
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/xsdata/formats/dataclass/parsers/bases.py:56: ParserError
Check warning on line 0 in tests.unit.xsdata_xml_test.Tests
github-actions / Tests results
test_page_domain (tests.unit.xsdata_xml_test.Tests) failed
junit/test-results.xml [took 0s]
Raw output
AttributeError: 'PageSearchResult' object has no attribute 'to_xml'
self = <tests.unit.xsdata_xml_test.Tests testMethod=test_page_domain>
def test_page_domain(self):
xml = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<api:pageSearchResult xmlns:api="urn:vpro:api:2013" xmlns="urn:vpro:media:2009" xmlns:media="urn:vpro:media:2009" xmlns:shared="urn:vpro:shared:2009" xmlns:pages="urn:vpro:pages:2013" total="432" totalQualifier="EQUAL_TO" offset="0" max="0">
<api:items>
<api:item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="api:searchResultItem" score="0.3099519">
<api:result xsi:type="pages:pageType" url="https://www.vprobroadcast.com/play~WO_VPRO_2297327~antibiotics~.html" type="VIDEO" creationDate="2019-11-22T14:15:09.443+01:00" lastModified="2019-11-22T14:15:09.443+01:00" lastPublished="2019-11-22T14:15:24.341+01:00" publishStart="2015-10-16T14:23:14.729+02:00" refCount="0" sortDate="2015-10-16T14:23:14.729+02:00">
<pages:crid>crid://vpro/media/vprobroadcast/WO_VPRO_2297327</pages:crid>
<pages:broadcaster id="VPRO"></pages:broadcaster>
<pages:portal id="VPROBROADCAST" url="https://www.vprobroadcast.com">
<pages:name>www.vprobroadcast.com</pages:name>
</pages:portal>
<pages:title>Antibiotics</pages:title>
<pages:images>
<pages:image type="PICTURE" url="https://images.poms.omroep.nl/image/s360/665086.jpg">
<pages:title>Antibiotica</pages:title>
<pages:description>Labyrint</pages:description>
</pages:image>
</pages:images>
</api:result>
</api:item>
</api:items>
<api:facets/>
<api:selectedFacets/>
</api:pageSearchResult>
"""
object = poms.from_string(xml)
print(str(object))
> print(object.to_xml())
E AttributeError: 'PageSearchResult' object has no attribute 'to_xml'
tests/unit/xsdata_xml_test.py:155: AttributeError
Check notice on line 0 in .github
github-actions / Tests results
34 tests found
There are 34 tests, see "Raw output" for the full list of tests.
Raw output
tests.unit.data_test.DataTests ‑ test_xml
tests.unit.media_backend_util_test.Tests ‑ testStripHtml
tests.unit.media_backend_util_test.Tests ‑ test_create_image
tests.unit.media_backend_util_test.Tests ‑ test_create_image_from_file
tests.unit.media_backend_util_test.Tests ‑ test_format_duration
tests.unit.media_backend_util_test.Tests ‑ test_parse_list
tests.unit.media_backend_util_test.Tests ‑ test_segments_as_members
tests.unit.npoapi_test.Tests ‑ test_authentication
tests.unit.npoapi_test.Tests ‑ test_env
tests.unit.pyxb_xml_test.Tests ‑ test_add_person
tests.unit.pyxb_xml_test.Tests ‑ test_image
tests.unit.pyxb_xml_test.Tests ‑ test_image2
tests.unit.pyxb_xml_test.Tests ‑ test_images_collection
tests.unit.pyxb_xml_test.Tests ‑ test_locations_collection
tests.unit.pyxb_xml_test.Tests ‑ test_media_domain
tests.unit.pyxb_xml_test.Tests ‑ test_media_form
tests.unit.pyxb_xml_test.Tests ‑ test_memberRefUpdate
tests.unit.pyxb_xml_test.Tests ‑ test_page_domain
tests.unit.pyxb_xml_test.Tests ‑ test_page_form
tests.unit.pyxb_xml_test.Tests ‑ test_page_update
tests.unit.pyxb_xml_test.Tests ‑ test_segment
tests.unit.pyxb_xml_test.Tests ‑ test_set_duration
tests.unit.pyxb_xml_test.Tests ‑ test_tolerate_xsi
tests.unit.transcoding_util_test.Tests ‑ test_parse_duration
tests.unit.transcoding_util_test.Tests ‑ test_parse_duration_s
tests.unit.xsdata_xml_test.Tests ‑ test_images_collection
tests.unit.xsdata_xml_test.Tests ‑ test_location_native_datetime
tests.unit.xsdata_xml_test.Tests ‑ test_location_xml_datetime
tests.unit.xsdata_xml_test.Tests ‑ test_locations
tests.unit.xsdata_xml_test.Tests ‑ test_locations_collection
tests.unit.xsdata_xml_test.Tests ‑ test_page_domain
tests.unit.xsdata_xml_test.Tests ‑ test_parse_page_update
tests.unit.xsdata_xml_test.Tests ‑ test_set_duration
tests.unit.xsdata_xml_test.Tests ‑ test_tolerate_xsi