Skip to content

Commit 216dc96

Browse files
committed
test IsolatedAsyncioTestCase.loop_factory
1 parent 0ed7c50 commit 216dc96

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Lib/test/test_unittest/test_async_case.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,5 +484,19 @@ async def test_demo1(self):
484484
result = test.run()
485485
self.assertTrue(result.wasSuccessful())
486486

487+
def test_loop_factory(self):
488+
asyncio.set_event_loop_policy(None)
489+
490+
class TestCase1(unittest.IsolatedAsyncioTestCase):
491+
loop_factory = asyncio.EventLoop
492+
493+
async def test_demo1(self):
494+
pass
495+
496+
test = TestCase1('test_demo1')
497+
result = test.run()
498+
self.assertTrue(result.wasSuccessful())
499+
self.assertIsNone(support.maybe_get_event_loop_policy())
500+
487501
if __name__ == "__main__":
488502
unittest.main()

0 commit comments

Comments
 (0)