Partial fix for #87

This commit is contained in:
hugovk 2014-03-03 23:03:45 +02:00
parent 2d42d3b15d
commit cd10d53a82
2 changed files with 15 additions and 1 deletions

View file

@ -1496,7 +1496,9 @@ class Artist(_BaseObject, _Taggable):
else: else:
params = None params = None
return _extract(self._request("artist.getInfo", True, params), "summary") doc = self._request("artist.getInfo", True, params)
return doc.getElementsByTagName('summary')[0].firstChild.wholeText.strip()
def get_bio_content(self, language=None): def get_bio_content(self, language=None):
"""Returns the content of the artist's biography.""" """Returns the content of the artist's biography."""

View file

@ -675,6 +675,18 @@ class TestPyLast(unittest.TestCase):
self.assertEqual(lastfm_user, loaded_user) self.assertEqual(lastfm_user, loaded_user)
def test_bio_summary(self):
# Arrange
artist = pylast.Artist("Test Artist", self.network)
# Act
bio = artist.get_bio_summary()
# Assert
self.assertIsNotNone(bio)
self.assertGreaterEqual(len(bio), 1)
if __name__ == '__main__': if __name__ == '__main__':
# For quick testing of a single case (eg. test = "test_scrobble") # For quick testing of a single case (eg. test = "test_scrobble")