Fixing issue, checking if elements by tag name have at least 1 element
This commit is contained in:
parent
a516a44c32
commit
219ce29f31
|
@ -1153,8 +1153,11 @@ class _BaseObject:
|
||||||
def _extract_cdata_from_request(self, method_name, tag_name, params):
|
def _extract_cdata_from_request(self, method_name, tag_name, params):
|
||||||
doc = self._request(method_name, True, params)
|
doc = self._request(method_name, True, params)
|
||||||
|
|
||||||
first_child = doc.getElementsByTagName(tag_name)[0].firstChild
|
elements = doc.getElementsByTagName(tag_name)
|
||||||
|
if len(elements) == 0:
|
||||||
|
return None
|
||||||
|
|
||||||
|
first_child = elements[0].firstChild
|
||||||
if first_child is None:
|
if first_child is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -417,3 +417,15 @@ class TestPyLastNetwork(TestPyLastWithLastFm):
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
assert int(total) > 10000
|
assert int(total) > 10000
|
||||||
|
|
||||||
|
def test_mbid_biography_issue(self):
|
||||||
|
# Arrange
|
||||||
|
mbid = "e2bef0c5-02e7-4505-b87f-90fc96bd70c3"
|
||||||
|
|
||||||
|
# Act
|
||||||
|
artist = self.network.get_artist_by_mbid(mbid)
|
||||||
|
|
||||||
|
# Assert
|
||||||
|
assert isinstance(artist, pylast.Artist)
|
||||||
|
assert artist.name == "Space 92"
|
||||||
|
assert artist.get_bio_content() is None
|
||||||
|
|
Loading…
Reference in a new issue