Skip to content

Commit 06495a1

Browse files
committed
Upgrade Python syntax
1 parent 4c76f8a commit 06495a1

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ repos:
4040
rev: v3.19.1
4141
hooks:
4242
- id: pyupgrade
43-
args: [--py3-plus]
43+
args: [--py37-plus]
4444

4545
- repo: https://github.com/rhysd/actionlint
4646
rev: v1.7.7

pytest_localserver/http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __bool__(self):
5656
def _encode_chunk(chunk, charset):
5757
if isinstance(chunk, str):
5858
chunk = chunk.encode(charset)
59-
return "{:x}".format(len(chunk)).encode(charset) + b"\r\n" + chunk + b"\r\n"
59+
return f"{len(chunk):x}".encode(charset) + b"\r\n" + chunk + b"\r\n"
6060

6161

6262
class ContentServer(WSGIServer):

tests/test_http.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def _format_chunk(chunk):
241241
if len(r) <= 40:
242242
return r
243243
else:
244-
return r[:13] + "..." + r[-14:] + " (length {})".format(len(chunk))
244+
return r[:13] + "..." + r[-14:] + f" (length {len(chunk)})"
245245

246246

247247
def _compare_chunks(expected, actual):
@@ -252,7 +252,7 @@ def _compare_chunks(expected, actual):
252252
for i, (e, a) in enumerate(itertools.zip_longest(expected, actual, fillvalue="<end>")):
253253
if e != a:
254254
message += [
255-
" Chunks differ at index {}:".format(i),
255+
f" Chunks differ at index {i}:",
256256
" Expected: " + (repr(expected[i : i + 5]) + "..." if e != "<end>" else "<end>"),
257257
" Found: " + (repr(actual[i : i + 5]) + "..." if a != "<end>" else "<end>"),
258258
]

0 commit comments

Comments
 (0)