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


Python MbXmlParser.getReleaseGroup方法代碼示例

本文整理匯總了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')
開發者ID:apotapov,項目名稱:musicproject,代碼行數:27,代碼來源:test_wsxml_releasegroup.py

示例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')
開發者ID:apotapov,項目名稱:musicproject,代碼行數:12,代碼來源:test_wsxml_releasegroup.py

示例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)
開發者ID:apotapov,項目名稱:musicproject,代碼行數:21,代碼來源:test_wsxml_releasegroup.py

示例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')
開發者ID:apotapov,項目名稱:musicproject,代碼行數:24,代碼來源:test_wsxml_releasegroup.py


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