def test_serialization(self): self.__sitdown_players() serial = self.seats.serialize() restored = Seats.deserialize(serial) for i in range(len(self.seats.players)): self.eq(Player.serialize(self.seats.players[i]), Player.serialize(restored.players[i]))
def deserialize(self, serial): deck = Deck.deserialize(serial[2]) community_card = [Card.from_id(cid) for cid in serial[3]] table = self(cheat_deck=deck) table.dealer_btn = serial[0] table.seats = Seats.deserialize(serial[1]) table._community_card = community_card table._blind_pos = serial[4] return table