本文整理汇总了Python中musicbrainz2.wsxml.MbXmlParser.getReleaseGroup方法的典型用法代码示例。如果您正苦于以下问题:Python MbXmlParser.getReleaseGroup方法的具体用法?Python MbXmlParser.getReleaseGroup怎么用?Python MbXmlParser.getReleaseGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类musicbrainz2.wsxml.MbXmlParser
的用法示例。
在下文中一共展示了MbXmlParser.getReleaseGroup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testReleaseGroupFull
# 需要导入模块: from musicbrainz2.wsxml import MbXmlParser [as 别名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import getReleaseGroup [as 别名]
def testReleaseGroupFull(self):
f = os.path.join(RELEASEGROUP_DIR, 'The_Cure_1.xml')
md = MbXmlParser().parse(f)
releaseGroup = md.getReleaseGroup()
self.failIf(releaseGroup is None)
releases = releaseGroup.getReleases()
self.failIf(releases is None)
self.assertEquals(len(releases), 4)
# Check releases, which are in no particular order.
expectedIds = [
'd984e1a3-7281-46bb-ad8b-1478a00f2fbf',
'c100a398-3132-48a8-a5fc-c3e908ac17dc',
'24bec892-b21d-47d8-a288-dc6450152574',
'61a4ec51-fa34-4757-85d7-83231776ed14']
actualIds = [release.id[-36:] for release in releases]
for expectedId in expectedIds:
self.assert_(expectedId in actualIds)
# Check artist
self.assertEquals(releaseGroup.getArtist().getName(), 'The Cure')
self.assertEquals(releaseGroup.getArtist().id[-36:],
'69ee3720-a7cb-4402-b48d-a02c366f2bcf')
示例2: testReleaseGroupBasic
# 需要导入模块: from musicbrainz2.wsxml import MbXmlParser [as 别名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import getReleaseGroup [as 别名]
def testReleaseGroupBasic(self):
f = os.path.join(RELEASEGROUP_DIR, 'The_Cure_1.xml')
md = MbXmlParser().parse(f)
releaseGroup = md.getReleaseGroup()
self.failIf(releaseGroup is None)
self.assertEquals(releaseGroup.getId(),
makeId('c6a62b78-70f7-44f7-b159-064f6b7ba03a'))
self.assertEquals(releaseGroup.getTitle(), 'The Cure')
self.assertEquals(releaseGroup.getType(), NS_MMD_1 + 'Album')
示例3: testEmptyType
# 需要导入模块: from musicbrainz2.wsxml import MbXmlParser [as 别名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import getReleaseGroup [as 别名]
def testEmptyType(self):
f = os.path.join(RELEASEGROUP_DIR, 'The_Cure_1.xml')
md1 = MbXmlParser().parse(f)
releaseGroup1 = md1.getReleaseGroup()
releaseGroup1.setType(None)
# Serialize.
outbuffer = StringIO()
MbXmlWriter().write(outbuffer, md1)
inbuffer = StringIO(outbuffer.getvalue().encode('utf-8'))
md2 = MbXmlParser().parse(inbuffer)
# Check
releaseGroup2 = md2.getReleaseGroup()
self.failIf(releaseGroup2 is None)
self.assertEquals(releaseGroup2.getType(), None)
示例4: testSerialize
# 需要导入模块: from musicbrainz2.wsxml import MbXmlParser [as 别名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import getReleaseGroup [as 别名]
def testSerialize(self):
# Get initial.
f = os.path.join(RELEASEGROUP_DIR, 'The_Cure_1.xml')
md1 = MbXmlParser().parse(f)
# Serialize.
outbuffer = StringIO()
MbXmlWriter().write(outbuffer, md1)
# Deserialize.
inbuffer = StringIO(outbuffer.getvalue().encode('utf-8'))
md2 = MbXmlParser().parse(inbuffer)
# Check
releaseGroup = md2.getReleaseGroup()
self.failIf(releaseGroup is None)
self.assertEquals(len(releaseGroup.getReleases()), 4)
self.assertEquals(releaseGroup.getId(),
makeId('c6a62b78-70f7-44f7-b159-064f6b7ba03a'))
self.assertEquals(releaseGroup.getTitle(), 'The Cure')
self.assertEquals(releaseGroup.getType(), NS_MMD_1 + 'Album')