def test_poll_one(mocks: Mocks, context: yogi.Context):
    """Checks the poll_one() function in the error-free case"""
    def fn(context, count):
        assert context == 1234
        assert count
        count.contents.value = 1
        return yogi.ErrorCode.OK

    mocks.MOCK_ContextPollOne(fn)
    assert context.poll_one() == 1
def test_poll_one_error(mocks: Mocks, context: yogi.Context):
    """Checks the poll_one() function in the error case"""
    mocks.MOCK_ContextPollOne(lambda *_: yogi.ErrorCode.WRONG_OBJECT_TYPE)
    with pytest.raises(yogi.FailureException):
        context.poll_one()