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