def test_export_parse(self): board = Board(size=9, win_chain_length=5) for i in range(10): board.make_random_move() parsed_board = Board.load(board.export()) self.assertEqual(board.pprint(lastmove_highlight=False), parsed_board.pprint(lastmove_highlight=False)) self.assertFalse(parsed_board.game_over()) self.assertFalse(parsed_board.game_won()) self.assertTrue(np.equal(parsed_board._matrix, board._matrix).all())
def test_double_serialize(self): board = Board(size=9, win_chain_length=5) json.loads(json.dumps(board.export()))