mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 06:04:15 +00:00
* regression test for https://github.com/Taxel/PlexTraktSync/discussions/1901 * bugfix https://github.com/Taxel/PlexTraktSync/discussions/1901
This commit is contained in:
parent
0108c95bd8
commit
25fa930c61
2 changed files with 10 additions and 1 deletions
|
@ -347,7 +347,7 @@ class PlexObject:
|
|||
kwargs['type'] = cls.TYPE
|
||||
# rtag to iter on a specific root tag using breadth-first search
|
||||
if rtag:
|
||||
data = next(utils.iterXMLBFS(data, rtag), [])
|
||||
data = next(utils.iterXMLBFS(data, rtag), Element('Empty'))
|
||||
# loop through all data elements to find matches
|
||||
items = MediaContainer[cls](self._server, data, initpath=initpath) if data.tag == 'MediaContainer' else []
|
||||
for elem in data:
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from xml.etree.ElementTree import Element
|
||||
|
||||
from plexapi.audio import Track
|
||||
from plexapi.base import MediaContainer
|
||||
|
||||
|
@ -30,3 +32,10 @@ def test_fetch_items_with_media_container(show):
|
|||
assert some_episodes.size == 2
|
||||
assert some_episodes.offset == 0
|
||||
assert some_episodes.totalSize == len(all_episodes)
|
||||
|
||||
|
||||
def test_find_items_empty_data(plex):
|
||||
result = plex.findItems(Element(""), rtag="foo")
|
||||
assert len(result) == 0
|
||||
result = plex.findItems(Element("MediaContainer"))
|
||||
assert isinstance(result, MediaContainer)
|
||||
|
|
Loading…
Reference in a new issue