当前位置: 首页>>代码示例>>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;未经允许,请勿转载。