예제 #1
0
 async def inner_test() -> None:
     async with TestServer(handler=StackHandler(), ip="::1") as sa:
         assert sa.ip and sa.port
         async with get_client(StackService, host=sa.ip,
                               port=sa.port) as client:
             self.assertEqual((3, 4, 5, 6), await
                              client.add_to(lst=(1, 2, 3, 4), value=2))
             self.assertEqual(66, (await client.get_simple()).val)
             await client.take_simple(simple(val=10))
예제 #2
0
 async def inner_test() -> None:
     async with TestServer(handler=StackHandler(), ip="::1") as sa:
         assert sa.ip and sa.port
         async with get_client(StackService, host=sa.ip,
                               port=sa.port) as client:
             self.assertEqual((3, 4, 5, 6), await
                              client.add_to(lst=(1, 2, 3, 4), value=2))
             self.assertEqual(66, (await client.get_simple()).val)
             await client.take_simple(simple(val=10))
             self.assertEqual(b"abc", bytes(await client.get_iobuf()))
             await client.take_iobuf(IOBuf(b"cba"))
             # currently unsupported by cpp backend:
             # self.assertEqual(b'xyz', (await client.get_iobuf_ptr()))
             await client.take_iobuf_ptr(IOBuf(b"zyx"))
예제 #3
0
 async def inner_test() -> None:
     async with TestServer(handler=StackHandler(), ip="::1") as sa:
         ip, port = sa.ip, sa.port
         assert ip and port
         # pyre-fixme[6]: Expected `Union[ipaddress.IPv4Address,
         #  ipaddress.IPv6Address, str]` for 2nd param but got `Union[None,
         #  ipaddress.IPv4Address, ipaddress.IPv6Address]`.
         async with get_client(StackService, host=ip,
                               port=port) as client:
             self.assertEqual((3, 4, 5, 6), await
                              client.add_to(lst=(1, 2, 3, 4), value=2))
             self.assertEqual(66, (await client.get_simple()).val)
             await client.take_simple(simple(val=10))
             self.assertEqual(b"abc", bytes(await client.get_iobuf()))
             await client.take_iobuf(IOBuf(b"cba"))
             # currently unsupported by cpp backend:
             # self.assertEqual(b'xyz', (await client.get_iobuf_ptr()))
             await client.take_iobuf_ptr(IOBuf(b"zyx"))
예제 #4
0
 async def get_simple(self) -> simple:
     return simple(val=66)
예제 #5
0
 async def get_simple_no_sa(self) -> simple:
     return simple(val=88)