本文整理汇总了Python中videos.models.SubtitleLanguage.percent_done方法的典型用法代码示例。如果您正苦于以下问题:Python SubtitleLanguage.percent_done方法的具体用法?Python SubtitleLanguage.percent_done怎么用?Python SubtitleLanguage.percent_done使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类videos.models.SubtitleLanguage
的用法示例。
在下文中一共展示了SubtitleLanguage.percent_done方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_update_tvlp_for_sl
# 需要导入模块: from videos.models import SubtitleLanguage [as 别名]
# 或者: from videos.models.SubtitleLanguage import percent_done [as 别名]
def test_update_tvlp_for_sl(self):
tv = TeamVideo.objects.get(id=2)
sl = SubtitleLanguage(
language='en',
is_original=True,
is_forked=False,
is_complete=True,
video=tv.video)
sl.save()
dl = SubtitleLanguage(
language='es',
is_original=False,
is_forked=False,
percent_done=40,
standard_language=sl,
video=tv.video)
dl.save()
tv = TeamVideo.objects.get(id=2)
tv.update_team_video_language_pairs()
dl = SubtitleLanguage.objects.get(id=dl.id)
dl.percent_done = 50
dl.save()
tv.update_team_video_language_pairs_for_sl(dl)
tvlps = self._tvlp_query_set(tv)
self.assertEquals(len(settings.ALL_LANGUAGES) * 2 - 2, len(tvlps))
for tvlp in tvlps:
if tvlp.language_0 == 'en':
if tvlp.language_1 == 'es':
self.assertEquals(50, tvlp.percent_complete)
else:
self.assertEquals(0, tvlp.percent_complete)
elif tvlp.language_0 == 'es':
self.assertEquals(0, tvlp.percent_complete)
示例2: test_update_lp_for_sl
# 需要导入模块: from videos.models import SubtitleLanguage [as 别名]
# 或者: from videos.models.SubtitleLanguage import percent_done [as 别名]
def test_update_lp_for_sl(self):
tv = TeamVideo.objects.get(id=2)
sl = SubtitleLanguage(
language='en',
is_original=True,
is_forked=False,
is_complete=True,
video=tv.video)
sl.save()
dl = SubtitleLanguage(
language='es',
is_original=False,
is_forked=False,
percent_done=40,
standard_language=sl,
video=tv.video)
dl.save()
tv = TeamVideo.objects.get(id=2)
dl = SubtitleLanguage.objects.get(id=dl.id)
dl.percent_done = 50
dl.save()
lps = tv.searchable_language_pairs()
self.assertEquals(len(settings.ALL_LANGUAGES) * 2 - 3, len(lps))
for lp in lps:
match = LANGUAGEPAIR_RE.match(lp)
if match.group(1) == 'en':
if match.group(2) == 'es':
self.assertEquals("M", match.group(3))
else:
self.assertEquals("0", match.group(3))
elif match.group(1) == 'es':
self.assertEquals("0", match.group(3))