GH-94597: add deprecation warnings for subclassing `AbstractChildWatcher` by kumaraditya303 · Pull Request #99386 · python/cpython
class AbstractChildWatcherTests(unittest.TestCase):
def test_warns_on_subclassing(self): with self.assertWarns(DeprecationWarning): class MyWatcher(asyncio.AbstractChildWatcher): pass
def test_not_implemented(self): f = mock.Mock() watcher = asyncio.AbstractChildWatcher()
self.assertIsInstance(policy.get_event_loop(), asyncio.AbstractEventLoop) watcher = policy.get_child_watcher() with warnings.catch_warnings(): warnings.simplefilter("ignore", DeprecationWarning) watcher = policy.get_child_watcher()
self.assertIsInstance(watcher, asyncio.SafeChildWatcher) self.assertIsNone(watcher._loop)