コード例 #1
0
ファイル: test_waiters.py プロジェクト: yadra/diesel
class TestWaitPoolWithEarlyReturn(object):
    def setup(self):
        self.pool = WaitPool()
        self.who = Who()
        self.waiter = EarlyReadyWaiter()
        self.result = self.pool.wait(self.who, self.waiter)

    def test_results_is_EarlyValue(self):
        assert isinstance(self.result, EarlyValue)
        assert self.result.val == "foo"

    def test_waiter_wait_id_not_added_to_wait_pool(self):
        assert self.waiter.wait_id not in self.pool.waits

    def test_who_not_added_to_wait_pool(self):
        assert self.who not in self.pool.loop_refs
コード例 #2
0
ファイル: test_waiters.py プロジェクト: 1angxi/diesel
class TestWaitPoolWithEarlyReturn(object):
    def setup(self):
        self.pool = WaitPool()
        self.who = Who()
        self.waiter = EarlyReadyWaiter()
        self.result = self.pool.wait(self.who, self.waiter)

    def test_results_is_EarlyValue(self):
        assert isinstance(self.result, EarlyValue)
        assert self.result.val == "foo"

    def test_waiter_wait_id_not_added_to_wait_pool(self):
        assert self.waiter.wait_id not in self.pool.waits

    def test_who_not_added_to_wait_pool(self):
        assert self.who not in self.pool.loop_refs
コード例 #3
0
ファイル: test_waiters.py プロジェクト: yadra/diesel
class TestWaitPoolWithStringWaiter(object):
    def setup(self):
        self.pool = WaitPool()
        self.who = Who()
        self.wait_for = "a string"
        self.result = self.pool.wait(self.who, self.wait_for)

    def test_the_waiting_entity_is_added_to_wait_pool(self):
        assert self.pool.waits[self.wait_for]
        w = self.pool.waits[self.wait_for].pop()
        assert w is self.who

    def test_StringWaiter_added_to_wait_pool(self):
        v = self.pool.loop_refs[self.who].pop()
        assert isinstance(v, StringWaiter)

    def test_result_is_wait_id(self):
        assert self.result == self.wait_for
コード例 #4
0
ファイル: test_waiters.py プロジェクト: 1angxi/diesel
class TestWaitPoolWithStringWaiter(object):
    def setup(self):
        self.pool = WaitPool()
        self.who = Who()
        self.wait_for = "a string"
        self.result = self.pool.wait(self.who, self.wait_for)

    def test_the_waiting_entity_is_added_to_wait_pool(self):
        assert self.pool.waits[self.wait_for]
        w = self.pool.waits[self.wait_for].pop()
        assert w is self.who

    def test_StringWaiter_added_to_wait_pool(self):
        v = self.pool.loop_refs[self.who].pop()
        assert isinstance(v, StringWaiter)

    def test_result_is_wait_id(self):
        assert self.result == self.wait_for