Ejemplo n.º 1
0
    def getOrCreateGame(self, game_id):
        if game_id not in self.games:
            game = PokerNetworkGameClient("poker.%s.xml", self.dirs)
            game.prefix = self.prefix
            game.id = game_id
            self.games[game_id] = game

        return self.games[game_id]
Ejemplo n.º 2
0
    def getOrCreateGame(self, game_id):
        if game_id not in self.games:
            game = PokerNetworkGameClient("poker.%s.xml", self.dirs)
            game.prefix = self.prefix
            game.id = game_id
            self.games[game_id] = game

        return self.games[game_id]
Ejemplo n.º 3
0
    def getOrCreateGame(self, game_id):
        if not self.games.has_key(game_id):
            game = PokerNetworkGameClient("poker.%s.xml", self.dirs)
            game.prefix = self.prefix
            game.verbose = self.verbose
            game.id = game_id
            self.games[game_id] = game

        return self.games[game_id]
Ejemplo n.º 4
0
    def getOrCreateGame(self, game_id):
        if not self.games.has_key(game_id):
            game = PokerNetworkGameClient("poker.%s.xml", self.dirs)
            game.prefix = self.prefix
            game.verbose = self.verbose
            game.id = game_id
            self.games[game_id] = game

        return self.games[game_id]
 def setUp(self):
     self.game = PokerNetworkGameClient("poker.%s.xml", [])
     self.game.verbose = int(os.environ.get('VERBOSE_T', '-1'))
class PokerNetworkGameClientTestCase(unittest.TestCase):

    def setUp(self):
        self.game = PokerNetworkGameClient("poker.%s.xml", [])
        self.game.verbose = int(os.environ.get('VERBOSE_T', '-1'))

    def test_init(self):
        for key in ( 'currency_serial', 'history_index', 'position_info' ):
            self.failUnless(hasattr(self.game, key))

    def test_reset(self):
        player_list = ['oups']
        self.game.setStaticPlayerList(player_list)
        self.game.reset()
        self.assertEqual(None, self.game.getStaticPlayerList())
        
    def test_endState(self):
        player_list = ['oups']
        self.game.setStaticPlayerList(player_list)
        self.game.endTurn = lambda: True
        self.game.endState()
        self.assertEqual(None, self.game.getStaticPlayerList())
        
    def test_cancelState(self):
        player_list = ['oups']
        self.game.setStaticPlayerList(player_list)
        self.game.cancelState()
        self.assertEqual(None, self.game.getStaticPlayerList())

    def test_buildPlayerList(self):
        player_serial = 10
        player_list = [10]
        self.failUnless(self.game.addPlayer(player_serial, 1))
        self.game.getPlayer(player_serial).sit_out = False
        self.game.setStaticPlayerList(player_list)
        self.failUnless(self.game.buildPlayerList(True))
        self.assertEqual(self.game.getStaticPlayerList(), self.game.player_list)
        self.failUnless(self.game.buildPlayerList(False))
        self.assertEqual(self.game.getStaticPlayerList(), self.game.player_list)
        self.game.getPlayer(player_serial).sit_out = True
        self.game.setStaticPlayerList([200])
        self.assertEqual(self.game.player_list, [200])
Ejemplo n.º 7
0
 def setUp(self):
     self.game = PokerNetworkGameClient("poker.%s.xml", [])
     self.game.verbose = int(os.environ.get('VERBOSE_T', '-1'))
Ejemplo n.º 8
0
class PokerNetworkGameClientTestCase(unittest.TestCase):
    def setUp(self):
        self.game = PokerNetworkGameClient("poker.%s.xml", [])
        self.game.verbose = int(os.environ.get('VERBOSE_T', '-1'))

    def test_init(self):
        for key in ('currency_serial', 'history_index', 'position_info'):
            self.failUnless(hasattr(self.game, key))

    def test_reset(self):
        player_list = ['oups']
        self.game.setStaticPlayerList(player_list)
        self.game.reset()
        self.assertEqual(None, self.game.getStaticPlayerList())

    def test_endState(self):
        player_list = ['oups']
        self.game.setStaticPlayerList(player_list)
        self.game.endTurn = lambda: True
        self.game.endState()
        self.assertEqual(None, self.game.getStaticPlayerList())

    def test_cancelState(self):
        player_list = ['oups']
        self.game.setStaticPlayerList(player_list)
        self.game.cancelState()
        self.assertEqual(None, self.game.getStaticPlayerList())

    def test_buildPlayerList(self):
        player_serial = 10
        player_list = [10]
        self.failUnless(self.game.addPlayer(player_serial, 1))
        self.game.getPlayer(player_serial).sit_out = False
        self.game.setStaticPlayerList(player_list)
        self.failUnless(self.game.buildPlayerList(True))
        self.assertEqual(self.game.getStaticPlayerList(),
                         self.game.player_list)
        self.failUnless(self.game.buildPlayerList(False))
        self.assertEqual(self.game.getStaticPlayerList(),
                         self.game.player_list)
        self.game.getPlayer(player_serial).sit_out = True
        self.game.setStaticPlayerList([200])
        self.game.buildPlayerList(None)
        self.assertEqual(self.game.player_list, [200])