本文整理汇总了Python中main.models.VideoLog.points方法的典型用法代码示例。如果您正苦于以下问题:Python VideoLog.points方法的具体用法?Python VideoLog.points怎么用?Python VideoLog.points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main.models.VideoLog
的用法示例。
在下文中一共展示了VideoLog.points方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_videolog_collision
# 需要导入模块: from main.models import VideoLog [as 别名]
# 或者: from main.models.VideoLog import points [as 别名]
def test_videolog_collision(self):
# create a new video log with the same youtube_id and user, but different points/total seconds watched
videolog = VideoLog(video_id=self.VIDEO_ID, youtube_id=self.YOUTUBE_ID, user=self.user)
videolog.points = self.NEW_POINTS
videolog.total_seconds_watched = self.NEW_SECONDS_WATCHED
# try saving the new VideoLog: this is where the collision will happen, hopefully leading to a merge
videolog.save()
# get a new reference to the existing VideoLog
videolog2 = VideoLog.objects.get(id=self.original_videolog.id)
# make sure the VideoLog has been properly merged
self.assertEqual(videolog.points, max(self.ORIGINAL_POINTS, self.NEW_POINTS), "The VideoLog's points were not properly merged.")
self.assertEqual(videolog.total_seconds_watched, max(self.ORIGINAL_ATTEMPTS, self.NEW_SECONDS_WATCHED), "The VideoLog's total seconds watched have already changed.")