def test_encode_pot(self): players = setup_players_for_pot() hsh = DataEncoder.encode_pot(players) main_pot = hsh["main"] side_pot1 = hsh["side"][0] side_pot2 = hsh["side"][1] self.eq(22, main_pot["amount"]) self.eq(9, side_pot1["amount"]) self.eq(3, len(side_pot1["eligibles"])) self.eq(['uuid1', 'uuid2', 'uuid3'], side_pot1['eligibles']) self.eq(4, side_pot2["amount"]) self.eq(2, len(side_pot2["eligibles"])) self.eq(['uuid1', 'uuid3'], side_pot2['eligibles'])
def test_encode_pot(self): players = setup_players_for_pot() hsh = DataEncoder.encode_pot(players) main_pot = hsh["main"] side_pot1 = hsh["side"][0] side_pot2 = hsh["side"][1] self.eq(22, main_pot["amount"]) self.eq(9, side_pot1["amount"]) self.eq(3, len(side_pot1["eligibles"])) self.eq(['uuid1', 'uuid2', 'uuid3'], side_pot1['eligibles']) self.eq(4, side_pot2["amount"]) self.eq(2, len(side_pot2["eligibles"])) self.eq(['uuid1', 'uuid3'], side_pot2['eligibles'])
def test_encode_round_state(self): state = setup_round_state() state["table"].set_blind_pos(1, 3) hsh = DataEncoder.encode_round_state(state) self.eq("flop", hsh["street"]) self.eq(DataEncoder.encode_pot(state["table"].seats.players), hsh["pot"]) self.eq(DataEncoder.encode_seats(state["table"].seats)["seats"], hsh["seats"]) self.eq(["CA"], hsh["community_card"]) self.eq(state["table"].dealer_btn, hsh["dealer_btn"]) self.eq(state["next_player"], hsh["next_player"]) self.eq(1, hsh["small_blind_pos"]) self.eq(3, hsh["big_blind_pos"]) self.eq(DataEncoder.encode_action_histories(state["table"])["action_histories"], hsh["action_histories"]) self.eq(state["round_count"], hsh["round_count"]) self.eq(state["small_blind_amount"], hsh["small_blind_amount"])
def test_encode_round_state(self): state = setup_round_state() state["table"].set_blind_pos(1, 3) hsh = DataEncoder.encode_round_state(state) self.eq("flop", hsh["street"]) self.eq(DataEncoder.encode_pot(state["table"].seats.players), hsh["pot"]) self.eq( DataEncoder.encode_seats(state["table"].seats)["seats"], hsh["seats"]) self.eq(["CA"], hsh["community_card"]) self.eq(state["table"].dealer_btn, hsh["dealer_btn"]) self.eq(state["next_player"], hsh["next_player"]) self.eq(1, hsh["small_blind_pos"]) self.eq(3, hsh["big_blind_pos"]) self.eq( DataEncoder.encode_action_histories( state["table"])["action_histories"], hsh["action_histories"]) self.eq(state["round_count"], hsh["round_count"]) self.eq(state["small_blind_amount"], hsh["small_blind_amount"])
def test_encode_round_state(self): state = setup_round_state() state['table'].set_blind_pos(1, 3) hsh = DataEncoder.encode_round_state(state) self.eq('flop', hsh['street']) self.eq(DataEncoder.encode_pot(state['table'].seats.players), hsh['pot']) self.eq( DataEncoder.encode_seats(state['table'].seats)['seats'], hsh['seats']) self.eq(['2d'], hsh['community_card']) self.eq(state['table'].dealer_btn, hsh['dealer_btn']) self.eq(state['next_player'], hsh['next_player']) self.eq(1, hsh['small_blind_pos']) self.eq(3, hsh['big_blind_pos']) self.eq( DataEncoder.encode_action_histories( state['table'])['action_histories'], hsh['action_histories']) self.eq(state['round_count'], hsh['round_count']) self.eq(state['small_blind_amount'], hsh['small_blind_amount'])