On this page
  1. unittest.IsolatedAsyncioTestCase
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

unittest.IsolatedAsyncioTestCase

Prev: unittest.installHandler | Up: unittest | Next: unittest.main
Rel: unittest.addModuleCleanup, unittest.doModuleCleanups, unittest.enterModuleContext, unittest.expectedFailure
Ref: docs.python.org — unittest.IsolatedAsyncioTestCase
Tags: #public #python3 #stdlib #unittest


Import

import unittest
from unittest import IsolatedAsyncioTestCase

Signature & Overview

unittest.IsolatedAsyncioTestCase(methodName='runTest')

unittest.IsolatedAsyncioTestCase class.

Methods & Attributes

Usage

import asyncio
import unittest

class AsyncDemo(unittest.IsolatedAsyncioTestCase):
    async def test_sleep(self) -> None:
        await asyncio.sleep(0)
        self.assertEqual(1 + 1, 2)

suite = unittest.defaultTestLoader.loadTestsFromTestCase(AsyncDemo)
res = unittest.TestResult()
suite.run(res)
assert res.wasSuccessful()

Gotchas

REPL Inspect

from unittest import IsolatedAsyncioTestCase
help(IsolatedAsyncioTestCase)

Linked from

Related notes