Skip to content

Commit db7fae1

Browse files
committed
apply pyupgrade
1 parent 5ce29a1 commit db7fae1

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

pytest_httpbin/plugin.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import absolute_import
2-
31
import pytest
42
from httpbin import app as httpbin_app
53

pytest_httpbin/serve.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def finish_request(self, request, client_address):
7676
# Thanks, WSGIRequestHandler!!
7777

7878

79-
class Server(object):
79+
class Server:
8080
"""
8181
HTTP server running a WSGI application in its own thread.
8282
"""
@@ -114,7 +114,7 @@ def stop(self):
114114

115115
@property
116116
def url(self):
117-
return "{0}://{1}:{2}".format(self.protocol, self.host, self.port)
117+
return f"{self.protocol}://{self.host}:{self.port}"
118118

119119
def join(self, url, allow_fragments=True):
120120
return urljoin(self.url, url, allow_fragments=allow_fragments)
@@ -125,5 +125,5 @@ class SecureServer(Server):
125125

126126
def __init__(self, host="127.0.0.1", port=0, application=None, **kwargs):
127127
kwargs["server_class"] = SecureWSGIServer
128-
super(SecureServer, self).__init__(host, port, application, **kwargs)
128+
super().__init__(host, port, application, **kwargs)
129129
self.protocol = "https"

tests/test_server.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# coding=utf8
2-
# -*- coding: utf8 -*-
3-
# vim: set fileencoding=utf8 :
4-
51
import os
62

73
import pytest
@@ -27,7 +23,7 @@ def test_unicode_data(httpbin):
2723
"""
2824
resp = requests.post(
2925
httpbin + "/post",
30-
data="оживлённым".encode("utf-8"),
26+
data="оживлённым".encode(),
3127
headers={
3228
"content-type": "text/html; charset=utf-8",
3329
},
@@ -67,7 +63,7 @@ def test_fixed_port_environment_variables(protocol):
6763
server_cls = serve.SecureServer
6864
envvar = "HTTPBIN_HTTPS_PORT"
6965
else:
70-
raise RuntimeError("Unexpected protocol param: {0}".format(protocol))
66+
raise RuntimeError(f"Unexpected protocol param: {protocol}")
7167

7268
# just have different port to avoid adrress already in use
7369
# if the second test run too fast after the first one (happens on pypy)

0 commit comments

Comments
 (0)