Work around Last.fm's 'Namespace prefix opensearch on totalResults is not defined' XML error
This commit is contained in:
parent
485d69184c
commit
52636b6764
|
@ -2483,7 +2483,7 @@ class _Search(_BaseObject):
|
|||
|
||||
doc = self._request(self._ws_prefix + ".search", True)
|
||||
|
||||
return _extract(doc, "opensearch:totalResults")
|
||||
return _extract(doc, "totalResults")
|
||||
|
||||
def _retrieve_page(self, page_index):
|
||||
"""Returns the node of matches to be processed"""
|
||||
|
|
|
@ -339,6 +339,18 @@ class TestPyLastNetwork(PyLastTestCase):
|
|||
self.assertIsInstance(results, list)
|
||||
self.assertIsInstance(results[0], pylast.Track)
|
||||
|
||||
def test_search_get_total_result_count(self):
|
||||
# Arrange
|
||||
artist = "Nirvana"
|
||||
track = "Smells Like Teen Spirit"
|
||||
search = self.network.search_for_track(artist, track)
|
||||
|
||||
# Act
|
||||
total = search.get_total_result_count()
|
||||
|
||||
# Assert
|
||||
self.assertGreater(int(total), 10000)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(failfast=True)
|
||||
|
|
Loading…
Reference in a new issue