当前位置: 首页>>代码示例>>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;未经允许,请勿转载。