diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2021-06-18 20:15:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-18 20:15:46 (GMT) |
commit | f60b07ab6c943fce084772c3c7731ab3bbd213ff (patch) | |
tree | a9c172b4ce1f0bed84d026738344be40037ea2b5 /Lib/test/test_httpservers.py | |
parent | df1502e47fc1e0cf1e7d460ae04530c3e2e4a7c6 (diff) | |
download | cpython-f60b07ab6c943fce084772c3c7731ab3bbd213ff.zip cpython-f60b07ab6c943fce084772c3c7731ab3bbd213ff.tar.gz cpython-f60b07ab6c943fce084772c3c7731ab3bbd213ff.tar.bz2 |
bpo-43945: [Enum] reduce scope of new format() behavior (GH-26752)
* [Enum] reduce scope of new format behavior
Instead of treating all Enums the same for format(), only user mixed-in
enums will be affected. In other words, IntEnum and IntFlag will not be
changing the format() behavior, due to the requirement that they be
drop-in replacements of existing integer constants.
If a user creates their own integer-based enum, then the new behavior
will apply:
class Grades(int, Enum):
A = 5
B = 4
C = 3
D = 2
F = 0
Now: format(Grades.B) -> DeprecationWarning and '4'
3.12: -> no warning, and 'B'
Diffstat (limited to 'Lib/test/test_httpservers.py')
-rw-r--r-- | Lib/test/test_httpservers.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index cb0a3aa..aeea020 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -259,7 +259,7 @@ class BaseHTTPServerTestCase(BaseTestCase): for code in (HTTPStatus.NO_CONTENT, HTTPStatus.NOT_MODIFIED, HTTPStatus.PROCESSING, HTTPStatus.RESET_CONTENT, HTTPStatus.SWITCHING_PROTOCOLS): - self.con.request('SEND_ERROR', '/{:d}'.format(code)) + self.con.request('SEND_ERROR', '/{}'.format(code)) res = self.con.getresponse() self.assertEqual(code, res.status) self.assertEqual(None, res.getheader('Content-Length')) @@ -276,7 +276,7 @@ class BaseHTTPServerTestCase(BaseTestCase): for code in (HTTPStatus.OK, HTTPStatus.NO_CONTENT, HTTPStatus.NOT_MODIFIED, HTTPStatus.RESET_CONTENT, HTTPStatus.SWITCHING_PROTOCOLS): - self.con.request('HEAD', '/{:d}'.format(code)) + self.con.request('HEAD', '/{}'.format(code)) res = self.con.getresponse() self.assertEqual(code, res.status) if code == HTTPStatus.OK: |