當前位置: 首頁>>代碼示例>>Python>>正文


Python History.user_coins方法代碼示例

本文整理匯總了Python中models.History.user_coins方法的典型用法代碼示例。如果您正苦於以下問題:Python History.user_coins方法的具體用法?Python History.user_coins怎麽用?Python History.user_coins使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.History的用法示例。


在下文中一共展示了History.user_coins方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testUpdatePoints

# 需要導入模塊: from models import History [as 別名]
# 或者: from models.History import user_coins [as 別名]
 def testUpdatePoints(self):
     Coin.add('points')
     Coin.add('gold')
     Formula.add('level-gold', definition='gold=10*{level}', owner=None)
     player = self._get_player()
     player.points = 82
     player.level_no = 1
     player.save()
     update_points(player, None)
     coins = History.user_coins(player.user)
     self.assertIn('gold', coins)
     self.assertEqual(coins['gold'], 20)
     player.points = 10
     player.save()
     update_points(player, None)
     coins = History.user_coins(player.user)
     self.assertIn('gold', coins)
     self.assertEqual(coins['gold'], 0)
開發者ID:AndreiRO,項目名稱:wouso,代碼行數:20,代碼來源:tests.py

示例2: testUpdatePoints

# 需要導入模塊: from models import History [as 別名]
# 或者: from models.History import user_coins [as 別名]
    def testUpdatePoints(self):
        IntegerListSetting.get('level_limits').set_value("80 125 180 245 320 450")

        Coin.add('points')
        Coin.add('gold')
        Formula.add('level-gold', expression='gold=10*{level}', owner=None)
        player = self._get_player()
        player.points = 82
        player.level_no = 1
        player.save()
        update_points(player, None)
        coins = History.user_coins(player.user)
        self.assertIn('gold', coins)
        self.assertEqual(coins['gold'], 20)
        player.points = 10
        player.save()
        update_points(player, None)
        coins = History.user_coins(player.user)
        self.assertIn('gold', coins)
        self.assertEqual(coins['gold'], 0)
開發者ID:Sendroiu,項目名稱:wouso,代碼行數:22,代碼來源:tests.py

示例3: test_update_points_level_upgrade_first_time

# 需要導入模塊: from models import History [as 別名]
# 或者: from models.History import user_coins [as 別名]
 def test_update_points_level_upgrade_first_time(self):
     level_up_points = 80
     IntegerListSetting.get('level_limits').set_value(str(level_up_points))
     Coin.add('points')
     Coin.add('gold')
     Formula.add('level-gold', expression='gold=10*{level}', owner=None)
     # Upgrade player's level
     player = self._get_player()
     player.points = level_up_points + 1
     player.level_no = 1
     player.save()
     update_points(player, None)
     coins = History.user_coins(player.user)
     self.assertEqual(coins['gold'], 10 * player.max_level)
開發者ID:PopAdi,項目名稱:wouso,代碼行數:16,代碼來源:tests.py

示例4: test_user_coins

# 需要導入模塊: from models import History [as 別名]
# 或者: from models.History import user_coins [as 別名]
 def test_user_coins(self):
     Coin.add('points')
     Coin.add('gold')
     player = self._get_player()
     scoring.score_simple(player, 'points', 10)
     self.assertIn('points', History.user_coins(player.user))
開發者ID:PopAdi,項目名稱:wouso,代碼行數:8,代碼來源:tests.py


注:本文中的models.History.user_coins方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。