From 00aabdc6a93b4d85b37d4ef938b0dede0aa19c99 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 22 May 2020 11:27:50 +0400 Subject: [PATCH] Fix a few ugly formattings --- trio/_core/tests/test_ki.py | 7 +++---- trio/_socket.py | 10 ++++------ trio/tests/test_util.py | 3 +-- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/trio/_core/tests/test_ki.py b/trio/_core/tests/test_ki.py index ed76f02c81..80f154cfb9 100644 --- a/trio/_core/tests/test_ki.py +++ b/trio/_core/tests/test_ki.py @@ -538,10 +538,9 @@ def test_ki_wakes_us_up(): # https://bitbucket.org/pypy/pypy/issues/2623 import platform - buggy_wakeup_fd = platform.python_implementation() == "CPython" and sys.version_info < ( - 3, - 6, - 2, + buggy_wakeup_fd = ( + sys.version_info < (3, 6, 2) + and platform.python_implementation() == "CPython" ) # lock is only needed to avoid an annoying race condition where the diff --git a/trio/_socket.py b/trio/_socket.py index aa08034dc6..44fd187889 100644 --- a/trio/_socket.py +++ b/trio/_socket.py @@ -341,15 +341,13 @@ def _make_simple_sock_method_wrapper(methname, wait_fn, maybe_avail=False): async def wrapper(self, *args, **kwargs): return await self._nonblocking_helper(fn, args, kwargs, wait_fn) - wrapper.__doc__ = """Like :meth:`socket.socket.{}`, but async. + wrapper.__doc__ = f"""Like :meth:`socket.socket.{methname}`, but async. - """.format( - methname - ) + """ if maybe_avail: wrapper.__doc__ += ( - "Only available on platforms where :meth:`socket.socket.{}` " - "is available.".format(methname) + f"Only available on platforms where :meth:`socket.socket.{methname}`" + " is available." ) return wrapper diff --git a/trio/tests/test_util.py b/trio/tests/test_util.py index b842b930cf..b08676e622 100644 --- a/trio/tests/test_util.py +++ b/trio/tests/test_util.py @@ -58,13 +58,12 @@ async def wait_with_ul1(): def test_module_metadata_is_fixed_up(): import trio + import trio.testing assert trio.Cancelled.__module__ == "trio" assert trio.open_nursery.__module__ == "trio" assert trio.abc.Stream.__module__ == "trio.abc" assert trio.lowlevel.wait_task_rescheduled.__module__ == "trio.lowlevel" - import trio.testing - assert trio.testing.trio_test.__module__ == "trio.testing" # Also check methods