]> granicus.if.org Git - python/commitdiff
bpo-32262: Fix typo in f-string (GH-7016)
authorChristian Heimes <christian@python.org>
Sun, 20 May 2018 17:57:13 +0000 (19:57 +0200)
committerGitHub <noreply@github.com>
Sun, 20 May 2018 17:57:13 +0000 (19:57 +0200)
Fix typo from commit 6370f345e1d5829e1fba59cd695c8b82c5a8c620

Signed-off-by: Christian Heimes <christian@python.org>
<!--
Thanks for your contribution!
Please read this comment in its entirety. It's quite important.

# Pull Request title

It should be in the following format:

```
bpo-NNNN: Summary of the changes made
```

Where: bpo-NNNN refers to the issue number in the https://bugs.python.org.

Most PRs will require an issue number. Trivial changes, like fixing a typo, do not need an issue.

# Backport Pull Request title

If this is a backport PR (PR made against branches other than `master`),
please ensure that the PR title is in the following format:

```
[X.Y] <title from the original PR> (GH-NNNN)
```

Where: [X.Y] is the branch name, e.g. [3.6].

GH-NNNN refers to the PR number from `master`.

-->

<!-- issue-number: bpo-32262 -->
https://bugs.python.org/issue32262
<!-- /issue-number -->

Lib/asyncio/base_subprocess.py
Lib/test/test_asyncio/test_subprocess.py

index 7c17066f8bb26c9af260bd623331f7ed3ffe48b8..b547c444ad5d1c24e282da99aeb46d8c3b22a9eb 100644 (file)
@@ -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:
index 81b08d6c292af00e66fc2105d29ab2813676bedc..428510f771612509e2c6dc11590bf5dce42b755d 100644 (file)
@@ -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),
+            "<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: