当前位置: 首页>>代码示例>>Python>>正文


Python utils.get_subs函数代码示例

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


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

示例1: test_update_end_time

 def test_update_end_time(self):
     dfxp = utils.get_subs("pre-drm.dfxp").to_internal()
     dfxp_updated = utils.get_subs("pre-drm.dfxp").to_internal()
     for i in xrange(0, len(dfxp)):
         dfxp_updated.update(i, to_ms=1000*i)
     for i,sub in enumerate(dfxp_updated.subtitle_items()):
         self.assertEqual(i * 1000, sub.end_time)
开发者ID:bendk,项目名称:babelsubs,代码行数:7,代码来源:test_storage.py

示例2: test_ttfa

    def test_ttfa(self):
        subs = utils.get_subs("pre-dmr.dfxp")
        self.assertEquals(len(subs), 419)
        # make sure the right namespace is in
        subs.subtitle_set._ttml.tag = '{http://www.w3.org/ns/ttml}tt'
        self.assertEqual(subs.subtitle_set._ttml.nsmap[None] , TTML_NAMESPACE_URI)

        subs = utils.get_subs("pre-dmr2.dfxp")
        self.assertEquals(len(subs), 19)
        # make sure the right namespace is in
        subs.subtitle_set._ttml.tag = '{http://www.w3.org/ns/ttml}tt'
开发者ID:mvliet,项目名称:babelsubs,代码行数:11,代码来源:test_dfxp.py

示例3: test_internal_format

 def test_internal_format(self):
     subs  = utils.get_subs("simple.sbv")
     parsed = subs.to_internal()
     sub_data = [x for x in parsed.subtitle_items()]
     self.assertEquals(sub_data[0][0], 48)
     self.assertEquals(sub_data[0][1], 2932)
     self.assertEquals(sub_data[0][2], 'We started Universal Subtitles because we believe')
开发者ID:bendk,项目名称:babelsubs,代码行数:7,代码来源:test_sbv.py

示例4: test_internal_format

 def test_internal_format(self):
     subs  = utils.get_subs("simple.dfxp")
     parsed = subs.to_internal()
     sub_data = [x for x in parsed.subtitle_items()]
     self.assertEquals(sub_data[0][0], 1200)
     self.assertEquals(sub_data[0][1], 4467)
     self.assertEquals(sub_data[3][2], 'at least 7,000 years ago.')
开发者ID:bendk,项目名称:babelsubs,代码行数:7,代码来源:test_dfxp.py

示例5: test_regions

 def test_regions(self):
     subs  = utils.get_subs("regions.vtt")
     items = subs.to_internal().subtitle_items()
     for sub in items[:4]:
         self.assertEquals(sub.region, "top")
     for sub in items[4:]:
         self.assertEquals(sub.region, None)
开发者ID:pculture,项目名称:babelsubs,代码行数:7,代码来源:test_webvtt.py

示例6: test_with_information_headers

 def test_with_information_headers(self):
     # we ignore those headers for now, but at least we shouldn't fail on them
     subs  = utils.get_subs("with-information-header.sbv")
     parsed = subs.to_internal()
     sub_data = [x for x in parsed.subtitle_items()]
     self.assertEquals(sub_data[0][0], 48)
     self.assertEquals(sub_data[0][1], 2932)
     self.assertEquals(sub_data[0][2], 'We started Universal Subtitles because we believe')
开发者ID:bendk,项目名称:babelsubs,代码行数:8,代码来源:test_sbv.py

示例7: test_basic

    def test_basic(self):
        subs = utils.get_subs("simple.srt")
        self.assertEquals(len(subs), 19)

        json_subs = JSONGenerator.generate(subs.to_internal())
        json_subs = json.loads(json_subs)

        self.assertEquals(len(json_subs), 19)
开发者ID:pculture,项目名称:babelsubs,代码行数:8,代码来源:test_json.py

示例8: test_nested_with_markup

 def test_nested_with_markup(self):
     dfxp = utils.get_subs("simple.dfxp").to_internal()
     # FIXME: actually this is wrong, as it's nested and we should have
     # the same text with underline and italics. At least we're not
     # loosing any text, and that's good enough for now, should be
     # fixed though.
     self.assertEqual( dfxp.get_content_with_markup(dfxp.get_subtitles()[38], SRTGenerator.MAPPINGS),
                       'a <u>word on </u><i>nested spans</i>')
开发者ID:bendk,项目名称:babelsubs,代码行数:8,代码来源:test_storage.py

示例9: test_round_trip

 def test_round_trip(self):
     subs1  = utils.get_subs("simple.sbv")
     parsed1 = subs1.to_internal()
     output = unicode(SBVGenerator(parsed1))
     subs2  = SBVParser(output, 'en')
     parsed2 = subs2.to_internal()
     self.assertEquals(len(subs1), len(subs2))
     for x1, x2 in zip([x for x in parsed1.subtitle_items()], [x for x in parsed2.subtitle_items()]):
         self.assertEquals(x1, x2)
开发者ID:bendk,项目名称:babelsubs,代码行数:9,代码来源:test_sbv.py

示例10: test_pre_drm_dfxp

 def test_pre_drm_dfxp(self):
     # tests a pretty feature rich dfpx file
     dfxp = utils.get_subs("pre-drm.dfxp").to_internal()
     self.assertEqual(len(dfxp), 419)
     dfxp = utils.get_subs("pre-drm2.dfxp").to_internal()
     self.assertEqual(len(dfxp), 19)
开发者ID:bendk,项目名称:babelsubs,代码行数:6,代码来源:test_storage.py

示例11: setUp

 def setUp(self):
     subs  = utils.get_subs("simple.srt")
     self.parsed = subs.to_internal()
     self.sub_data = [x for x in self.parsed.subtitle_items(HTMLGenerator.MAPPINGS)]
开发者ID:bendk,项目名称:babelsubs,代码行数:4,代码来源:test_html.py

示例12: test_nested_tags

 def test_nested_tags(self):
     dfxp = utils.get_subs("simple.dfxp").to_internal()
     self.assertEqual( storage.get_contents(dfxp.get_subtitles()[37]), 'nested spans')
     self.assertEqual( storage.get_contents(dfxp.get_subtitles()[38]), 'a word on nested spans')
开发者ID:bendk,项目名称:babelsubs,代码行数:4,代码来源:test_storage.py

示例13: test_self_generate

    def test_self_generate(self):
        parsed_subs1 = utils.get_subs("simple.dfxp")
        parsed_subs2 = DFXPParser(DFXPGenerator(parsed_subs1.subtitle_set, 'en').__unicode__())

        for x1, x2 in zip([x for x in  parsed_subs1.to_internal()], [x for x in parsed_subs2.to_internal()]):
            self.assertEquals(x1, x2)
开发者ID:bendk,项目名称:babelsubs,代码行数:6,代码来源:test_dfxp.py

示例14: test_unsynced

 def test_unsynced(self):
     sset = utils.get_subs('i-2376.dfxp').subtitle_set
     self.assertFalse(sset.fully_synced)
开发者ID:mvliet,项目名称:babelsubs,代码行数:3,代码来源:test_dfxp.py

示例15: test_basic

 def test_basic(self):
     subs = utils.get_subs("simple.dfxp")
     self.assertEquals(len(subs), 76)
开发者ID:bendk,项目名称:babelsubs,代码行数:3,代码来源:test_dfxp.py


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