本文整理汇总了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]