• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python _common.open_and_parse_test_data函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中test._common.open_and_parse_test_data函数的典型用法代码示例。如果您正苦于以下问题:Python open_and_parse_test_data函数的具体用法?Python open_and_parse_test_data怎么用?Python open_and_parse_test_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了open_and_parse_test_data函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: testArtistCredit

    def testArtistCredit(self):
        """
        If the artist credit is the same in the track and recording, make sure that
        the information is replicated in both objects, otherwise have distinct ones.
        """

        # If no artist-credit in the track, copy in the recording one
        res = _common.open_and_parse_test_data(
            self.datadir, "833d4c3a-2635-4b7a-83c4-4e560588f23a-recordings+artist-credits.xml"
        )
        tracks = res["release"]["medium-list"][0]["track-list"]
        t1 = tracks[1]
        self.assertEqual(t1["artist-credit"], t1["recording"]["artist-credit"])
        self.assertEqual("JT Bruce", t1["artist-credit-phrase"])
        self.assertEqual(t1["recording"]["artist-credit-phrase"], t1["artist-credit-phrase"])

        # Recording AC is different to track AC
        res = _common.open_and_parse_test_data(
            self.datadir, "fbe4490e-e366-4da2-a37a-82162d2f41a9-recordings+artist-credits.xml"
        )
        tracks = res["release"]["medium-list"][0]["track-list"]
        t1 = tracks[1]
        self.assertNotEqual(t1["artist-credit"], t1["recording"]["artist-credit"])
        self.assertEqual("H. Lichner", t1["artist-credit-phrase"])
        self.assertNotEqual(t1["recording"]["artist-credit-phrase"], t1["artist-credit-phrase"])
开发者ID:sxalexander,项目名称:python-musicbrainzngs,代码行数:25,代码来源:test_mbxml_release.py


示例2: testWorkAliases

    def testWorkAliases(self):
        res = _common.open_and_parse_test_data(self.datadir, "80737426-8ef3-3a9c-a3a6-9507afb93e93-aliases.xml")
        aliases = res["work"]["alias-list"]
        self.assertEqual(len(aliases), 2)

        a0 = aliases[0]
        self.assertEqual(a0["alias"], 'Symphonie Nr. 3 Es-Dur, Op. 55 "Eroica"')
        self.assertEqual(a0["sort-name"], 'Symphonie Nr. 3 Es-Dur, Op. 55 "Eroica"')

        a1 = aliases[1]
        self.assertEqual(a1["alias"], 'Symphony No. 3, Op. 55 "Eroica"')
        self.assertEqual(a1["sort-name"], 'Symphony No. 3, Op. 55 "Eroica"')

        work_attrs = res["work"]["attribute-list"]
        self.assertEqual(len(work_attrs), 1)
        attr = work_attrs[0]
        self.assertEqual(attr["type"], "Key")
        self.assertEqual(attr["attribute"], "E-flat major")

        res = _common.open_and_parse_test_data(self.datadir, "3d7c7cd2-da79-37f4-98b8-ccfb1a4ac6c4-aliases.xml")
        aliases = res["work"]["alias-list"]
        self.assertEqual(len(aliases), 10)

        a0 = aliases[0]
        self.assertEqual(a0["alias"], "Adagio from Symphony No. 2 in E minor, Op. 27")
        self.assertEqual(a0["sort-name"], "Adagio from Symphony No. 2 in E minor, Op. 27")
开发者ID:JonnyJD,项目名称:python-musicbrainzngs,代码行数:26,代码来源:test_mbxml_work.py


示例3: testTrackCount

    def testTrackCount(self):
        """
        Test that the number of tracks (offset-count) is returned.
        """

        # discid without pregap track
        res = _common.open_and_parse_test_data(self.datadir, "xp5tz6rE4OHrBafj0bLfDRMGK48-.xml")
        self.assertEqual(res["disc"]["offset-count"], 8)

        # discid with pregap track
        # (the number of tracks does not count the pregap "track")
        res = _common.open_and_parse_test_data(self.datadir, "f7agNZK1HMQ2WUWq9bwDymw9aHA-.xml")
        self.assertEqual(res["disc"]["offset-count"], 13)
开发者ID:EliotBerriot,项目名称:python-musicbrainzngs,代码行数:13,代码来源:test_mbxml_discid.py


示例4: testReleaseList

 def testReleaseList(self):
     """
     Test that a release list of correct size is given.
     """
     res = _common.open_and_parse_test_data(self.datadir, "xp5tz6rE4OHrBafj0bLfDRMGK48-.xml")
     self.assertEqual(res["disc"]["release-count"], 3)
     self.assertEqual(res["disc"]["release-count"], len(res["disc"]["release-list"]))
开发者ID:EliotBerriot,项目名称:python-musicbrainzngs,代码行数:7,代码来源:test_mbxml_discid.py


示例5: testTrackLength

    def testTrackLength(self):
        """
        Test that if there is a track length, then `track_or_recording_length` has
        that, but if not then fill the value from the recording length
        """
        res = _common.open_and_parse_test_data(self.datadir, "b66ebe6d-a577-4af8-9a2e-a029b2147716-recordings.xml")
        tracks = res["release"]["medium-list"][0]["track-list"]

        # No track length and recording length
        t1 = tracks[0]
        self.assertTrue("length" not in t1)
        self.assertEqual("180000", t1["recording"]["length"])
        self.assertEqual("180000", t1["track_or_recording_length"])

        # Track length and recording length same
        t2 = tracks[1]
        self.assertEqual("279000", t2["length"])
        self.assertEqual("279000", t2["recording"]["length"])
        self.assertEqual("279000", t2["track_or_recording_length"])

        # Track length and recording length different
        t3 = tracks[2]
        self.assertEqual("60000", t3["length"])
        self.assertEqual("80000", t3["recording"]["length"])
        self.assertEqual("60000", t3["track_or_recording_length"])

        # No track lengths
        t4 = tracks[3]
        self.assertTrue("length" not in t4["recording"])
        self.assertTrue("length" not in t4)
        self.assertTrue("track_or_recording_length" not in t4)
开发者ID:ChrisNolan1992,项目名称:python-musicbrainzngs,代码行数:31,代码来源:test_mbxml_release.py


示例6: testTypesExist

 def testTypesExist(self):
     res = _common.open_and_parse_test_data(self.datadir,
                       "f52bc6a1-c848-49e6-85de-f8f53459a624.xml")
     rg = res["release-group"]
     self.assertTrue("type" in rg)
     self.assertTrue("primary-type" in rg)
     self.assertTrue("secondary-type-list" in rg)
开发者ID:ChrisNolan1992,项目名称:python-musicbrainzngs,代码行数:7,代码来源:test_mbxml_release_group.py


示例7: testTrackId

 def testTrackId(self):
     """
     Test that the id attribute of tracks is read.
     """
     res = _common.open_and_parse_test_data(self.datadir, "212895ca-ee36-439a-a824-d2620cd10461-recordings.xml")
     tracks = res["release"]["medium-list"][0]["track-list"]
     map(lambda t: self.assertTrue("id" in t), tracks)
开发者ID:ChrisNolan1992,项目名称:python-musicbrainzngs,代码行数:7,代码来源:test_mbxml_release.py


示例8: testTrackNumber

    def testTrackNumber(self):
        """
        Test that track number (number or text) and track position (always an increasing number)
        are both read properly
        """
        res = _common.open_and_parse_test_data(self.datadir, "212895ca-ee36-439a-a824-d2620cd10461-recordings.xml")
        tracks = res["release"]["medium-list"][0]["track-list"]
        # This release doesn't number intro tracks as numbered tracks,
        # so position and number get 'out of sync'
        self.assertEqual(['1', '2', '3'], [t["position"] for t in tracks[:3]])
        self.assertEqual(['', '1', '2'], [t["number"] for t in tracks[:3]])

        res = _common.open_and_parse_test_data(self.datadir, "a81f3c15-2f36-47c7-9b0f-f684a8b0530f-recordings.xml")
        tracks = res["release"]["medium-list"][0]["track-list"]
        self.assertEqual(['1', '2'], [t["position"] for t in tracks])
        self.assertEqual(['A', 'B'], [t["number"] for t in tracks])
开发者ID:ChrisNolan1992,项目名称:python-musicbrainzngs,代码行数:16,代码来源:test_mbxml_release.py


示例9: testPlace

 def testPlace(self):
     event_id = "770fb0b4-0ad8-4774-9275-099b66627355"
     res = _common.open_and_parse_test_data(self.datadir, "%s-place-rels.xml" % event_id)
     place = res["event"]["place-relation-list"][0]["place"]
     self.assertEqual("7643f13a-dcda-4db4-8196-3ffcc1b99ab7", place["id"])
     self.assertEqual("50.33556", place["coordinates"]["latitude"])
     self.assertEqual("6.9475", place["coordinates"]["longitude"])
开发者ID:alastair,项目名称:python-musicbrainzngs,代码行数:7,代码来源:test_mbxml_event.py


示例10: testEventElements

 def testEventElements(self):
     filename = "e921686d-ba86-4122-bc3b-777aec90d231-tags-artist-rels.xml"
     res = _common.open_and_parse_test_data(self.datadir, filename)
     e = res["event"]
     keys = ["name", "life-span", "time", "setlist", "artist-relation-list", "tag-list"]
     for k in keys:
         self.assertTrue(k in e, "key %s in dict" % (k, ))
开发者ID:alastair,项目名称:python-musicbrainzngs,代码行数:7,代码来源:test_mbxml_event.py


示例11: testTypesResult

 def testTypesResult(self):
     res = _common.open_and_parse_test_data(self.datadir,
                       "f52bc6a1-c848-49e6-85de-f8f53459a624.xml")
     rg = res["release-group"]
     self.assertEqual("Soundtrack", rg["type"])
     self.assertEqual("Album", rg["primary-type"])
     self.assertEqual(["Soundtrack"], rg["secondary-type-list"])
开发者ID:ChrisNolan1992,项目名称:python-musicbrainzngs,代码行数:7,代码来源:test_mbxml_release_group.py


示例12: testCollectionReleases

 def testCollectionReleases(self):
     """
     Test that the list of releases is given.
     """
     res = _common.open_and_parse_test_data(self.datadir, "0b15c97c-8eb8-4b4f-81c3-0eb24266a2ac-releases.xml")
     self.assertEqual(res["collection"]["release-count"], 400)
     self.assertTrue("release-list" in res["collection"])
开发者ID:JonnyJD,项目名称:python-musicbrainzngs,代码行数:7,代码来源:test_mbxml_collection.py


示例13: testTags

    def testTags(self):
        res = _common.open_and_parse_test_data(self.datadir, "6505f98c-f698-4406-8bf4-8ca43d05c36f-tags.xml")
        inst = res["instrument"]

        tags = inst["tag-list"]
        self.assertEqual(len(tags), 3)
        self.assertEqual(tags[0]["name"], "fixme")
        self.assertEqual(tags[0]["count"], "1")
开发者ID:EliotBerriot,项目名称:python-musicbrainzngs,代码行数:8,代码来源:test_mbxml_instrument.py


示例14: testDataTracklist

 def testDataTracklist(self):
     """
     Test that data tracklist are parsed.
     """
     res = _common.open_and_parse_test_data(self.datadir, "9ce41d09-40e4-4d33-af0c-7fed1e558dba-recordings.xml")
     medium = res["release"]["medium-list"][0]
     self.assertTrue("data-track-list" in medium)
     self.assertEqual(198, len(medium["data-track-list"]))
开发者ID:EliotBerriot,项目名称:python-musicbrainzngs,代码行数:8,代码来源:test_mbxml_release.py


示例15: testListFromBrowse

    def testListFromBrowse(self):
        filename = "browse-area-74e50e58-5deb-4b99-93a2-decbb365c07f-annotation.xml"
        res = _common.open_and_parse_test_data(self.datadir, filename)

        self.assertEqual(395, res["place-count"])
        self.assertEqual(25, len(res["place-list"]))

        self.assertTrue(res["place-list"][13]["annotation"]["text"].startswith("was later renamed"))
开发者ID:EliotBerriot,项目名称:python-musicbrainzngs,代码行数:8,代码来源:test_mbxml_place.py


示例16: testCollectionInfo

 def testCollectionInfo(self):
     """
     Test that the id, name and author are given.
     """
     res = _common.open_and_parse_test_data(self.datadir, "0b15c97c-8eb8-4b4f-81c3-0eb24266a2ac-releases.xml")
     self.assertEqual(res["collection"]["id"], "0b15c97c-8eb8-4b4f-81c3-0eb24266a2ac")
     self.assertEqual(res["collection"]["name"], "My Collection")
     self.assertEqual(res["collection"]["editor"], "JonnyJD")
开发者ID:JonnyJD,项目名称:python-musicbrainzngs,代码行数:8,代码来源:test_mbxml_collection.py


示例17: testCollectionType

    def testCollectionType(self):
        """
        Test if the type of the collection is parsed correctly.
        """

        res = _common.open_and_parse_test_data(self.datadir, "0b15c97c-8eb8-4b4f-81c3-0eb24266a2ac-releases.xml")
        self.assertEqual(res["collection"]["entity-type"], "release")
        self.assertEqual(res["collection"]["type"], "Release")
开发者ID:JonnyJD,项目名称:python-musicbrainzngs,代码行数:8,代码来源:test_mbxml_collection.py


示例18: testArtistAliases

    def testArtistAliases(self):
        res = _common.open_and_parse_test_data(self.datadir, "0e43fe9d-c472-4b62-be9e-55f971a023e1-aliases.xml")
        aliases = res["artist"]["alias-list"]
        self.assertEqual(len(aliases), 28)

        a0 = aliases[0]
        self.assertEqual(a0["alias"], "Prokofief")
        self.assertEqual(a0["sort-name"], "Prokofief")

        a17 = aliases[17]
        self.assertEqual(a17["alias"], "Sergei Sergeyevich Prokofiev")
        self.assertEqual(a17["sort-name"], "Prokofiev, Sergei Sergeyevich")
        self.assertEqual(a17["locale"], "en")
        self.assertEqual(a17["primary"], "primary")

        res = _common.open_and_parse_test_data(self.datadir, "2736bad5-6280-4c8f-92c8-27a5e63bbab2-aliases.xml")
        self.assertFalse("alias-list" in res["artist"])
开发者ID:ChrisNolan1992,项目名称:python-musicbrainzngs,代码行数:17,代码来源:test_mbxml_artist.py


示例19: testData

    def testData(self):
        res = _common.open_and_parse_test_data(self.datadir, "9447c0af-5569-48f2-b4c5-241105d58c91.xml")
        inst = res["instrument"]

        self.assertEqual(inst["id"], "9447c0af-5569-48f2-b4c5-241105d58c91")
        self.assertEqual(inst["name"], "bass saxophone")
        self.assertEqual(inst["type"], "Wind instrument")
        self.assertTrue(inst["description"].startswith("The bass saxophone"))
开发者ID:EliotBerriot,项目名称:python-musicbrainzngs,代码行数:8,代码来源:test_mbxml_instrument.py


示例20: testVideo

 def testVideo(self):
     """
     Test that the video attribute is parsed.
     """
     res = _common.open_and_parse_test_data(self.datadir, "fe29e7f0-eb46-44ba-9348-694166f47885-recordings.xml")
     trackswithoutvideo = res["release"]["medium-list"][0]["track-list"]
     trackswithvideo = res["release"]["medium-list"][2]["track-list"]
     map(lambda t: self.assertTrue("video" not in ["recording"]), trackswithoutvideo)
     map(lambda t: self.assertEqual("true", t["recording"]["video"]), trackswithvideo)
开发者ID:ChrisNolan1992,项目名称:python-musicbrainzngs,代码行数:9,代码来源:test_mbxml_release.py



注:本文中的test._common.open_and_parse_test_data函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python _common.platform_posix函数代码示例发布时间:2022-05-27
下一篇:
Python _common.item函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap