def test_finish(self):
        f = Future()
        ag = AsyncGroup(partial(f.set_result, True))

        self.assertEqual(ag._finish_cb_called, False)

        ag.add_notification()
        ag.finish()

        self.assertEqual(ag._finish_cb_called, True)
        self.assertEqual(ag._aborted, False)
        self.assertEqual(f.result(), True)
Beispiel #2
0
    def test_finish(self):
        f = Future()
        ag = AsyncGroup(partial(f.set_result, True))

        self.assertEqual(ag._finish_cb_called, False)

        ag.add_notification()
        ag.finish()

        self.assertEqual(ag._finish_cb_called, True)
        self.assertEqual(ag._aborted, False)
        self.assertEqual(f.result(), True)
    def test_notifications(self):
        f = Future()
        ag = AsyncGroup(partial(f.set_result, True))
        not1 = ag.add_notification()
        not2 = ag.add_notification()

        self.assertEqual(ag._finish_cb_called, False)

        not1()

        self.assertEqual(ag._finish_cb_called, False)

        not2('params', are='ignored')

        self.assertEqual(ag._finish_cb_called, True)
        self.assertEqual(ag._aborted, False)
        self.assertEqual(f.result(), True)
Beispiel #4
0
    def test_notifications(self):
        f = Future()
        ag = AsyncGroup(partial(f.set_result, True))
        not1 = ag.add_notification()
        not2 = ag.add_notification()

        self.assertEqual(ag._finish_cb_called, False)

        not1()

        self.assertEqual(ag._finish_cb_called, False)

        not2('params', are='ignored')

        self.assertEqual(ag._finish_cb_called, True)
        self.assertEqual(ag._aborted, False)
        self.assertEqual(f.result(), True)