本文整理匯總了Python中bootcamp.activities.models.Activity.monthly_activity方法的典型用法代碼示例。如果您正苦於以下問題:Python Activity.monthly_activity方法的具體用法?Python Activity.monthly_activity怎麽用?Python Activity.monthly_activity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類bootcamp.activities.models.Activity
的用法示例。
在下文中一共展示了Activity.monthly_activity方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_activity_monthly_statistic
# 需要導入模塊: from bootcamp.activities.models import Activity [as 別名]
# 或者: from bootcamp.activities.models.Activity import monthly_activity [as 別名]
def test_activity_monthly_statistic(self):
activity_one = Activity.objects.create(
user=self.user,
activity_type='L'
)
activity_two = Activity.objects.create(
user=self.user,
activity_type='L'
)
activity_three = Activity.objects.create(
user=self.user,
activity_type='L'
)
self.assertTrue(isinstance(activity_one, Activity))
self.assertTrue(isinstance(activity_two, Activity))
self.assertTrue(isinstance(activity_three, Activity))
self.assertEqual(Activity.monthly_activity(self.user)[0],
'[{}]'.format(Activity.objects.all().count()))
self.assertEqual(Activity.monthly_activity(self.other_user)[0], '0')