From d361e99868a9eaa7ffce9341e1207705dbb66b50 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sun, 20 May 2018 19:57:13 +0200 Subject: [PATCH] bpo-32262: Fix typo in f-string (GH-7016) Fix typo from commit 6370f345e1d5829e1fba59cd695c8b82c5a8c620 Signed-off-by: Christian Heimes https://bugs.python.org/issue32262 --- Lib/asyncio/base_subprocess.py | 2 +- Lib/test/test_asyncio/test_subprocess.py | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Lib/asyncio/base_subprocess.py b/Lib/asyncio/base_subprocess.py index 7c17066f8b..b547c444ad 100644 --- a/Lib/asyncio/base_subprocess.py +++ b/Lib/asyncio/base_subprocess.py @@ -57,7 +57,7 @@ class BaseSubprocessTransport(transports.SubprocessTransport): if self._closed: info.append('closed') if self._pid is not None: - info.append(f'pid={self.pid}') + info.append(f'pid={self._pid}') if self._returncode is not None: info.append(f'returncode={self._returncode}') elif self._pid is not None: diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py index 81b08d6c29..428510f771 100644 --- a/Lib/test/test_asyncio/test_subprocess.py +++ b/Lib/test/test_asyncio/test_subprocess.py @@ -29,6 +29,7 @@ class TestSubprocessTransport(base_subprocess.BaseSubprocessTransport): self._proc.stdin = None self._proc.stdout = None self._proc.stderr = None + self._proc.pid = -1 class SubprocessTransportTests(test_utils.TestCase): @@ -73,6 +74,29 @@ class SubprocessTransportTests(test_utils.TestCase): transport.close() + def test_subprocess_repr(self): + waiter = asyncio.Future(loop=self.loop) + transport, protocol = self.create_transport(waiter) + transport._process_exited(6) + self.loop.run_until_complete(waiter) + + self.assertEqual( + repr(transport), + "" + ) + transport._returncode = None + self.assertEqual( + repr(transport), + "" + ) + transport._pid = None + transport._returncode = None + self.assertEqual( + repr(transport), + "" + ) + transport.close() + class SubprocessMixin: -- 2.40.0