Пример #1
0
async def test_stream_stream_simple(loop):
    async with ClientServer(loop=loop) as (_, stub):
        replies = await stub.Devilry([
            UnyoungChunk(whome='guv'),
            UnyoungChunk(whome='lactic'),
            UnyoungChunk(whome='scrawn'),
        ])
        assert replies == [
            GoowyChunk(biomes='guv'),
            GoowyChunk(biomes='lactic'),
            GoowyChunk(biomes='scrawn'),
        ]
Пример #2
0
async def test_stream_stream_advanced(loop):
    async with ClientServer(loop=loop) as (_, stub):
        async with stub.Devilry.open() as stream:
            await stream.send_message(UnyoungChunk(whome='guv'))
            assert await stream.recv_message() == GoowyChunk(biomes='guv')

            await stream.send_message(UnyoungChunk(whome='lactic'))
            assert await stream.recv_message() == GoowyChunk(biomes='lactic')

            await stream.send_message(UnyoungChunk(whome='scrawn'), end=True)
            assert await stream.recv_message() == GoowyChunk(biomes='scrawn')

            assert await stream.recv_message() is None
Пример #3
0
async def test_stream_unary_advanced(loop):
    async with ClientServer(loop=loop) as (handler, stub):
        async with stub.Anginal.open() as stream:
            await stream.send_message(UnyoungChunk(whome='canopy'))
            await stream.send_message(UnyoungChunk(whome='iver'))
            await stream.send_message(UnyoungChunk(whome='part'), end=True)
            reply = await stream.recv_message()
        assert reply == SavoysReply(benito='anagogy')
        assert handler.log == [UnyoungChunk(whome='canopy'),
                               UnyoungChunk(whome='iver'),
                               UnyoungChunk(whome='part')]
Пример #4
0
async def test_stream_unary_simple(loop):
    async with ClientServer(loop=loop) as (handler, stub):
        reply = await stub.Anginal([
            UnyoungChunk(whome='canopy'),
            UnyoungChunk(whome='iver'),
            UnyoungChunk(whome='part'),
        ])
        assert reply == SavoysReply(benito='anagogy')
        assert handler.log == [UnyoungChunk(whome='canopy'),
                               UnyoungChunk(whome='iver'),
                               UnyoungChunk(whome='part')]