如何测试aiohttp和peeweeasync?

2024-05-29 03:45:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用aiohttp和peeweeasync为我的数据库类运行2个异步测试。在

@unittest_run_loop
async def test_create_instance(self):
    instance = await self.model.create_instance({})
    self.assertTrue(isinstance(instance, dict))
    self.assertTrue(instance is not None)

@unittest_run_loop
async def test_retrieve_instance(self):
    instance = await self.model.create_instance({})
    retrieved = await self.model.retrieve_instance(int(instance['id']))
    self.assertTrue(instance == retrieved)

但我付出的只是

^{pr2}$

感谢您的关注!在


Tags: instanceruntestselfloopasyncmodelaiohttp

热门问题