[Python-checkins] [3.7] bpo-32262: Fix typo in f-string (GH-7016)
Christian Heimes
webhook-mailer at python.org
Sun May 20 14:22:59 EDT 2018
https://github.com/python/cpython/commit/b85115ed4c5d4e80ab818b44401e71299de9e9a5
commit: b85115ed4c5d4e80ab818b44401e71299de9e9a5
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Christian Heimes <christian at python.org>
date: 2018-05-20T20:22:50+02:00
summary:
[3.7] bpo-32262: Fix typo in f-string (GH-7016)
Fix typo from commit 6370f345e1d5829e1fba59cd695c8b82c5a8c620
(cherry picked from commit d361e99868a9eaa7ffce9341e1207705dbb66b50)
Co-authored-by: Christian Heimes <christian at python.org>
files:
M Lib/asyncio/base_subprocess.py
M Lib/test/test_asyncio/test_subprocess.py
diff --git a/Lib/asyncio/base_subprocess.py b/Lib/asyncio/base_subprocess.py
index 7c17066f8bb2..b547c444ad5d 100644
--- a/Lib/asyncio/base_subprocess.py
+++ b/Lib/asyncio/base_subprocess.py
@@ -57,7 +57,7 @@ def __repr__(self):
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 81b08d6c292a..428510f77161 100644
--- a/Lib/test/test_asyncio/test_subprocess.py
+++ b/Lib/test/test_asyncio/test_subprocess.py
@@ -29,6 +29,7 @@ def _start(self, *args, **kwargs):
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 @@ def test_proc_exited(self):
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),
+ "<TestSubprocessTransport pid=-1 returncode=6>"
+ )
+ transport._returncode = None
+ self.assertEqual(
+ repr(transport),
+ "<TestSubprocessTransport pid=-1 running>"
+ )
+ transport._pid = None
+ transport._returncode = None
+ self.assertEqual(
+ repr(transport),
+ "<TestSubprocessTransport not started>"
+ )
+ transport.close()
+
class SubprocessMixin:
More information about the Python-checkins
mailing list