當前位置: 首頁>>代碼示例>>Python>>正文


Python MbXmlParser.getReleaseGroupResultsCount方法代碼示例

本文整理匯總了Python中musicbrainz2.wsxml.MbXmlParser.getReleaseGroupResultsCount方法的典型用法代碼示例。如果您正苦於以下問題:Python MbXmlParser.getReleaseGroupResultsCount方法的具體用法?Python MbXmlParser.getReleaseGroupResultsCount怎麽用?Python MbXmlParser.getReleaseGroupResultsCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在musicbrainz2.wsxml.MbXmlParser的用法示例。


在下文中一共展示了MbXmlParser.getReleaseGroupResultsCount方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testSearchResults

# 需要導入模塊: from musicbrainz2.wsxml import MbXmlParser [as 別名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import getReleaseGroupResultsCount [as 別名]
	def testSearchResults(self):
		f = os.path.join(RELEASEGROUP_DIR, 'search_result_1.xml')
		md = MbXmlParser().parse(f)
		releaseGroups = md.getReleaseGroupResults()

		self.failIf(releaseGroups is None)
		self.assertEquals(md.getReleaseGroupResultsOffset(), 0)
		self.assertEquals(md.getReleaseGroupResultsCount(), 3)

		expectedEntries = {
			'963eac15-e3da-3a92-aa5c-2ec23bfb6ec2': ['Signal Morning', 100],
			'0bd324a3-1c90-3bdb-8ca4-4101a580c62c': ['Circulatory System', 98],
			'ea7d8352-7751-30be-8490-bb6df737f47c': ['Inside Views', 90]}
		for result in releaseGroups:
			releaseGroup = result.releaseGroup
			self.failIf(releaseGroup is None)

			releaseGroupId = releaseGroup.id[-36:]
			self.assert_(releaseGroupId in expectedEntries)

			expectedTitle, expectedScore = expectedEntries[releaseGroupId]
			self.assertEquals(releaseGroup.title, expectedTitle)
			self.assertEquals(result.score, expectedScore)

			del expectedEntries[releaseGroupId]
開發者ID:apotapov,項目名稱:musicproject,代碼行數:27,代碼來源:test_wsxml_releasegroup.py


注:本文中的musicbrainz2.wsxml.MbXmlParser.getReleaseGroupResultsCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。