本文整理匯總了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', {})