def METHOD_NAME(self):
    """Testing Polyglot book creation"""
    widgets = uistuff.GladeWidgets("PyChess.glade")
    gamewidget.setWidgets(widgets)
    perspective_manager.set_widgets(widgets)
    self.games_persp = Games()
    perspective_manager.add_perspective(self.games_persp)
    self.database_persp = Database()
    self.database_persp.create_toolbuttons()
    perspective_manager.add_perspective(self.database_persp)
    self.database_persp.open_chessfile(PGN)
    async def coro():
        def on_book_created(persp, event):
            self.assertTrue(os.path.isfile(BIN))
            testcase = testcases[0]
            board = LBoard(Board)
            board.applyFen(testcase[0])
            openings = book.getOpenings(board)
            self.assertEqual(
                sorted(openings),
                sorted([(newMove(E2, E4), 2, 0), (newMove(A2, A4), 0, 0)]),
            )
            testcase = testcases[-1]
            board = LBoard(Board)
            board.applyFen(testcase[0])
            openings = book.getOpenings(board)
            self.assertEqual(openings, [])
            event.set()
        event = asyncio.Event()
        self.database_persp.connect("bookfile_created", on_book_created, event)
        self.database_persp.create_book(BIN)
        await event.wait()
    loop = asyncio.get_event_loop()
    loop.set_debug(enabled=True)
    loop.run_until_complete(coro())