From cd10d53a82587b48bfe133ffdf3fe64a142e398c Mon Sep 17 00:00:00 2001 From: hugovk Date: Mon, 3 Mar 2014 23:03:45 +0200 Subject: [PATCH] Partial fix for #87 --- pylast.py | 4 +++- test_pylast.py | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pylast.py b/pylast.py index 3a9d2fc..379d40a 100644 --- a/pylast.py +++ b/pylast.py @@ -1496,7 +1496,9 @@ class Artist(_BaseObject, _Taggable): else: 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): """Returns the content of the artist's biography.""" diff --git a/test_pylast.py b/test_pylast.py index ea7444d..3264728 100755 --- a/test_pylast.py +++ b/test_pylast.py @@ -675,6 +675,18 @@ class TestPyLast(unittest.TestCase): 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__': # For quick testing of a single case (eg. test = "test_scrobble")