diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2022-01-13 14:28:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-13 14:28:02 (GMT) |
commit | f779faccd3a7a7e8c372492e858d021c449cdd85 (patch) | |
tree | 5db5425d10ba836a6dd34b5f6c666667669c7d90 /Lib/test/test_asyncio/test_events.py | |
parent | 8c49d057bf8618208d4ed67c9caecbfa71f7a2d0 (diff) | |
download | cpython-f779faccd3a7a7e8c372492e858d021c449cdd85.zip cpython-f779faccd3a7a7e8c372492e858d021c449cdd85.tar.gz cpython-f779faccd3a7a7e8c372492e858d021c449cdd85.tar.bz2 |
bpo-46358: modernize `test_asyncio` (GH-30562)
Diffstat (limited to 'Lib/test/test_asyncio/test_events.py')
-rw-r--r-- | Lib/test/test_asyncio/test_events.py | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index c46c9dd..a30867e 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -737,14 +737,6 @@ class EventLoopTestsMixin: @unittest.skipIf(ssl is None, 'No ssl module') def test_ssl_connect_accepted_socket(self): - if (sys.platform == 'win32' and - sys.version_info < (3, 5) and - isinstance(self.loop, proactor_events.BaseProactorEventLoop) - ): - raise unittest.SkipTest( - 'SSL not supported with proactor event loops before Python 3.5' - ) - server_context = test_utils.simple_server_sslcontext() client_context = test_utils.simple_client_sslcontext() @@ -2206,17 +2198,15 @@ class HandleTests(test_utils.TestCase): self.assertRegex(repr(h), regex) # partial method - if sys.version_info >= (3, 4): - method = HandleTests.test_handle_repr - cb = functools.partialmethod(method) - filename, lineno = test_utils.get_function_source(method) - h = asyncio.Handle(cb, (), self.loop) - - cb_regex = r'<function HandleTests.test_handle_repr .*>' - cb_regex = (r'functools.partialmethod\(%s, , \)\(\)' % cb_regex) - regex = (r'^<Handle %s at %s:%s>$' - % (cb_regex, re.escape(filename), lineno)) - self.assertRegex(repr(h), regex) + method = HandleTests.test_handle_repr + cb = functools.partialmethod(method) + filename, lineno = test_utils.get_function_source(method) + h = asyncio.Handle(cb, (), self.loop) + + cb_regex = r'<function HandleTests.test_handle_repr .*>' + cb_regex = fr'functools.partialmethod\({cb_regex}, , \)\(\)' + regex = fr'^<Handle {cb_regex} at {re.escape(filename)}:{lineno}>$' + self.assertRegex(repr(h), regex) def test_handle_repr_debug(self): self.loop.get_debug.return_value = True |