本文整理汇总了Python中game.models.Game.rm_user_from_game方法的典型用法代码示例。如果您正苦于以下问题:Python Game.rm_user_from_game方法的具体用法?Python Game.rm_user_from_game怎么用?Python Game.rm_user_from_game使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类game.models.Game
的用法示例。
在下文中一共展示了Game.rm_user_from_game方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_rm_user_from_game
# 需要导入模块: from game.models import Game [as 别名]
# 或者: from game.models.Game import rm_user_from_game [as 别名]
def test_rm_user_from_game(self):
game, _ = Game.create_new_game(self.aMap.id, self.user)
# Perform the join logic
_, _, player_id = Game.add_user_to_game(game.id, self.joiner)
# Perform the removing logic
players_json = Game.rm_user_from_game(game.id, 1)
# Check a bunch of conditions
self.assertEqual(len(players_json), 3)
self.assertEqual(players_json[0], "hosting_player")
self.assertEqual(players_json[1], "")
示例2: on_leave
# 需要导入模块: from game.models import Game [as 别名]
# 或者: from game.models.Game import rm_user_from_game [as 别名]
def on_leave(self):
game_id = self.session['game_id']
self.leave(str(game_id))
Game.rm_user_from_game(game_id, self.session['player_id'])
self.broadcast_message('leave', {})