From a647b30365593a4a3056fcf6936f5441ab9eda88 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 17 Oct 2016 17:29:45 +1300 Subject: python3: clean up class brackets --- test/mitmproxy/console/test_pathedit.py | 2 +- test/mitmproxy/protocol/test_http1.py | 2 +- test/mitmproxy/protocol/test_http2.py | 2 +- test/mitmproxy/protocol/test_websockets.py | 2 +- test/mitmproxy/test_controller.py | 10 +++++----- test/mitmproxy/test_examples.py | 2 +- test/mitmproxy/test_flow.py | 2 +- test/mitmproxy/test_flow_export.py | 12 ++++++------ test/mitmproxy/test_proxy.py | 2 +- test/mitmproxy/tservers.py | 2 +- test/netlib/http/http1/test_read.py | 4 ++-- test/netlib/http/test_headers.py | 2 +- test/netlib/http/test_message.py | 8 ++++---- test/netlib/http/test_request.py | 6 +++--- test/netlib/http/test_response.py | 6 +++--- test/netlib/test_multidict.py | 10 +++++----- test/netlib/tservers.py | 2 +- test/netlib/websockets/test_frame.py | 4 ++-- test/netlib/websockets/test_masker.py | 2 +- test/netlib/websockets/test_utils.py | 2 +- test/pathod/test_language_base.py | 2 +- test/pathod/test_pathod.py | 2 +- test/pathod/test_protocols_http2.py | 12 ++++++------ test/pathod/tutils.py | 2 +- 24 files changed, 51 insertions(+), 51 deletions(-) (limited to 'test') diff --git a/test/mitmproxy/console/test_pathedit.py b/test/mitmproxy/console/test_pathedit.py index ff6ef846..45c69a38 100644 --- a/test/mitmproxy/console/test_pathedit.py +++ b/test/mitmproxy/console/test_pathedit.py @@ -51,7 +51,7 @@ class TestPathCompleter: assert c.final == s -class TestPathEdit(): +class TestPathEdit: def test_keypress(self): diff --git a/test/mitmproxy/protocol/test_http1.py b/test/mitmproxy/protocol/test_http1.py index 3bf1210e..d2c473d7 100644 --- a/test/mitmproxy/protocol/test_http1.py +++ b/test/mitmproxy/protocol/test_http1.py @@ -6,7 +6,7 @@ from netlib.tutils import treq from .. import tutils, tservers -class TestHTTPFlow(): +class TestHTTPFlow: def test_repr(self): f = tutils.tflow(resp=True, err=True) diff --git a/test/mitmproxy/protocol/test_http2.py b/test/mitmproxy/protocol/test_http2.py index c0f7007d..3a222c10 100644 --- a/test/mitmproxy/protocol/test_http2.py +++ b/test/mitmproxy/protocol/test_http2.py @@ -89,7 +89,7 @@ class _Http2ServerBase(netlib_tservers.ServerTestBase): raise NotImplementedError() -class _Http2TestBase(): +class _Http2TestBase: @classmethod def setup_class(cls): diff --git a/test/mitmproxy/protocol/test_websockets.py b/test/mitmproxy/protocol/test_websockets.py index f7756f25..094d9298 100644 --- a/test/mitmproxy/protocol/test_websockets.py +++ b/test/mitmproxy/protocol/test_websockets.py @@ -44,7 +44,7 @@ class _WebSocketsServerBase(netlib_tservers.ServerTestBase): traceback.print_exc() -class _WebSocketsTestBase(): +class _WebSocketsTestBase: @classmethod def setup_class(cls): diff --git a/test/mitmproxy/test_controller.py b/test/mitmproxy/test_controller.py index bd3dfe4e..84f762e6 100644 --- a/test/mitmproxy/test_controller.py +++ b/test/mitmproxy/test_controller.py @@ -15,7 +15,7 @@ class TMsg: pass -class TestMaster(): +class TestMaster: def test_simple(self): class DummyMaster(controller.Master): @controller.handler @@ -44,7 +44,7 @@ class TestMaster(): m.shutdown() -class TestServerThread(): +class TestServerThread: def test_simple(self): m = Mock() t = controller.ServerThread(m) @@ -52,7 +52,7 @@ class TestServerThread(): assert m.serve_forever.called -class TestChannel(): +class TestChannel: def test_tell(self): q = queue.Queue() channel = controller.Channel(q, Event()) @@ -86,7 +86,7 @@ class TestChannel(): channel.ask("test", Mock(name="test_ask_shutdown")) -class TestReply(): +class TestReply: def test_simple(self): reply = controller.Reply(42) assert reply.state == "unhandled" @@ -179,7 +179,7 @@ class TestReply(): reply.commit() -class TestDummyReply(): +class TestDummyReply: def test_simple(self): reply = controller.DummyReply() for _ in range(2): diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py index 81e8801c..05b7544f 100644 --- a/test/mitmproxy/test_examples.py +++ b/test/mitmproxy/test_examples.py @@ -99,7 +99,7 @@ class TestScripts(mastertest.MasterTest): assert f.request.host == "mitmproxy.org" -class TestHARDump(): +class TestHARDump: def flow(self, resp_content=b'message'): times = dict( diff --git a/test/mitmproxy/test_flow.py b/test/mitmproxy/test_flow.py index b4052c62..38d61afe 100644 --- a/test/mitmproxy/test_flow.py +++ b/test/mitmproxy/test_flow.py @@ -37,7 +37,7 @@ def test_app_registry(): assert ar.get(r) -class TestHTTPFlow(): +class TestHTTPFlow: def test_copy(self): f = tutils.tflow(resp=True) diff --git a/test/mitmproxy/test_flow_export.py b/test/mitmproxy/test_flow_export.py index 86ff937d..920f538b 100644 --- a/test/mitmproxy/test_flow_export.py +++ b/test/mitmproxy/test_flow_export.py @@ -31,7 +31,7 @@ def req_patch(): return netlib.tutils.treq(method=b'PATCH', path=b"/path?query=param") -class TestExportCurlCommand(): +class TestExportCurlCommand: def test_get(self): flow = tutils.tflow(req=req_get()) result = """curl -H 'header:qvalue' -H 'content-length:7' 'http://address/path?a=foo&a=bar&b=baz'""" @@ -48,7 +48,7 @@ class TestExportCurlCommand(): assert export.curl_command(flow) == result -class TestExportPythonCode(): +class TestExportPythonCode: def test_get(self): flow = tutils.tflow(req=req_get()) python_equals("data/test_flow_export/python_get.py", export.python_code(flow)) @@ -69,7 +69,7 @@ class TestExportPythonCode(): python_equals("data/test_flow_export/python_patch.py", export.python_code(flow)) -class TestExportLocustCode(): +class TestExportLocustCode: def test_get(self): flow = tutils.tflow(req=req_get()) python_equals("data/test_flow_export/locust_get.py", export.locust_code(flow)) @@ -86,7 +86,7 @@ class TestExportLocustCode(): python_equals("data/test_flow_export/locust_patch.py", export.locust_code(flow)) -class TestExportLocustTask(): +class TestExportLocustTask: def test_get(self): flow = tutils.tflow(req=req_get()) python_equals("data/test_flow_export/locust_task_get.py", export.locust_task(flow)) @@ -100,7 +100,7 @@ class TestExportLocustTask(): python_equals("data/test_flow_export/locust_task_patch.py", export.locust_task(flow)) -class TestIsJson(): +class TestIsJson: def test_empty(self): assert export.is_json(None, None) is False @@ -119,7 +119,7 @@ class TestIsJson(): assert isinstance(j, dict) -class TestURL(): +class TestURL: def test_url(self): flow = tutils.tflow() assert export.url(flow) == "http://address:22/path" diff --git a/test/mitmproxy/test_proxy.py b/test/mitmproxy/test_proxy.py index 48bb94ca..5904ce5b 100644 --- a/test/mitmproxy/test_proxy.py +++ b/test/mitmproxy/test_proxy.py @@ -14,7 +14,7 @@ from netlib.http import http1 from . import tutils -class TestServerConnection(): +class TestServerConnection: def test_simple(self): self.d = test.Daemon() diff --git a/test/mitmproxy/tservers.py b/test/mitmproxy/tservers.py index e597570e..6796e243 100644 --- a/test/mitmproxy/tservers.py +++ b/test/mitmproxy/tservers.py @@ -74,7 +74,7 @@ class ProxyThread(threading.Thread): self.tmaster.shutdown() -class ProxyTestBase(): +class ProxyTestBase: # Test Configuration ssl = None ssloptions = False diff --git a/test/netlib/http/http1/test_read.py b/test/netlib/http/http1/test_read.py index fb27857b..a768a722 100644 --- a/test/netlib/http/http1/test_read.py +++ b/test/netlib/http/http1/test_read.py @@ -104,7 +104,7 @@ def test_read_response_head(): assert rfile.read() == b"skip" -class TestReadBody(): +class TestReadBody: def test_chunked(self): rfile = BytesIO(b"3\r\nfoo\r\n0\r\n\r\nbar") body = b"".join(read_body(rfile, None)) @@ -289,7 +289,7 @@ def test_check_http_version(): _check_http_version(b"HTTP/1.b") -class TestReadHeaders(): +class TestReadHeaders: @staticmethod def _read(data): return _read_headers(BytesIO(data)) diff --git a/test/netlib/http/test_headers.py b/test/netlib/http/test_headers.py index d214ca02..63f16897 100644 --- a/test/netlib/http/test_headers.py +++ b/test/netlib/http/test_headers.py @@ -4,7 +4,7 @@ from netlib.http.headers import Headers, parse_content_type, assemble_content_ty from netlib.tutils import raises -class TestHeaders(): +class TestHeaders: def _2host(self): return Headers( ( diff --git a/test/netlib/http/test_message.py b/test/netlib/http/test_message.py index 9a5b80ed..dd08e018 100644 --- a/test/netlib/http/test_message.py +++ b/test/netlib/http/test_message.py @@ -36,7 +36,7 @@ def _test_decoded_attr(message, attr): assert getattr(message.data, attr) == b"FOO\xBF\x00BAR" -class TestMessageData(): +class TestMessageData: def test_eq_ne(self): data = tresp(timestamp_start=42, timestamp_end=42).data same = tresp(timestamp_start=42, timestamp_end=42).data @@ -50,7 +50,7 @@ class TestMessageData(): assert data != 0 -class TestMessage(): +class TestMessage: def test_init(self): resp = tresp() @@ -108,7 +108,7 @@ class TestMessage(): assert r.content == b"ggfootoo" -class TestMessageContentEncoding(): +class TestMessageContentEncoding: def test_simple(self): r = tresp() assert r.raw_content == b"message" @@ -186,7 +186,7 @@ class TestMessageContentEncoding(): assert "content-encoding" not in r.headers -class TestMessageText(): +class TestMessageText: def test_simple(self): r = tresp(content=b'\xfc') assert r.raw_content == b"\xfc" diff --git a/test/netlib/http/test_request.py b/test/netlib/http/test_request.py index bcb1cc43..e091f280 100644 --- a/test/netlib/http/test_request.py +++ b/test/netlib/http/test_request.py @@ -6,7 +6,7 @@ from netlib.tutils import treq, raises from .test_message import _test_decoded_attr, _test_passthrough_attr -class TestRequestData(): +class TestRequestData: def test_init(self): with raises(ValueError): treq(headers="foobar") @@ -14,7 +14,7 @@ class TestRequestData(): assert isinstance(treq(headers=()).headers, Headers) -class TestRequestCore(): +class TestRequestCore: """ Tests for builtins and the attributes that are directly proxied from the data structure """ @@ -92,7 +92,7 @@ class TestRequestCore(): assert request.headers["Host"] == "example.org" -class TestRequestUtils(): +class TestRequestUtils: """ Tests for additional convenience methods. """ diff --git a/test/netlib/http/test_response.py b/test/netlib/http/test_response.py index 6ab043c1..66d6e307 100644 --- a/test/netlib/http/test_response.py +++ b/test/netlib/http/test_response.py @@ -11,7 +11,7 @@ from netlib.tutils import raises, tresp from .test_message import _test_passthrough_attr, _test_decoded_attr -class TestResponseData(): +class TestResponseData: def test_init(self): with raises(ValueError): tresp(headers="foobar") @@ -19,7 +19,7 @@ class TestResponseData(): assert isinstance(tresp(headers=()).headers, Headers) -class TestResponseCore(): +class TestResponseCore: """ Tests for builtins and the attributes that are directly proxied from the data structure """ @@ -60,7 +60,7 @@ class TestResponseCore(): _test_decoded_attr(tresp(), "reason") -class TestResponseUtils(): +class TestResponseUtils: """ Tests for additional convenience methods. """ diff --git a/test/netlib/test_multidict.py b/test/netlib/test_multidict.py index bad5e2b4..a9523fd9 100644 --- a/test/netlib/test_multidict.py +++ b/test/netlib/test_multidict.py @@ -2,7 +2,7 @@ from netlib import tutils from netlib.multidict import MultiDict, ImmutableMultiDict, MultiDictView -class _TMulti(): +class _TMulti: @staticmethod def _kconv(key): return key.lower() @@ -16,7 +16,7 @@ class TImmutableMultiDict(_TMulti, ImmutableMultiDict): pass -class TestMultiDict(): +class TestMultiDict: @staticmethod def _multi(): return TMultiDict(( @@ -194,7 +194,7 @@ class TestMultiDict(): assert md == md2 -class TestImmutableMultiDict(): +class TestImmutableMultiDict: def test_modify(self): md = TImmutableMultiDict() with tutils.raises(TypeError): @@ -224,7 +224,7 @@ class TestImmutableMultiDict(): assert md.with_insert(0, "foo", "bar").fields == (("foo", "bar"),) -class TParent(): +class TParent: def __init__(self): self.vals = tuple() @@ -235,7 +235,7 @@ class TParent(): return self.vals -class TestMultiDictView(): +class TestMultiDictView: def test_modify(self): p = TParent() tv = MultiDictView(p.getter, p.setter) diff --git a/test/netlib/tservers.py b/test/netlib/tservers.py index d22be413..fdf40ff3 100644 --- a/test/netlib/tservers.py +++ b/test/netlib/tservers.py @@ -85,7 +85,7 @@ class _TServer(tcp.TCPServer): self.q.put(s.getvalue()) -class ServerTestBase(): +class ServerTestBase: ssl = None handler = None addr = ("localhost", 0) diff --git a/test/netlib/websockets/test_frame.py b/test/netlib/websockets/test_frame.py index 265d2513..a039dcb1 100644 --- a/test/netlib/websockets/test_frame.py +++ b/test/netlib/websockets/test_frame.py @@ -6,7 +6,7 @@ from netlib import websockets from netlib import tutils -class TestFrameHeader(): +class TestFrameHeader: @pytest.mark.parametrize("input,expected", [ (0, '0100'), @@ -123,7 +123,7 @@ class TestFrameHeader(): assert f.masking_key -class TestFrame(): +class TestFrame: def test_equality(self): f = websockets.Frame(payload=b'1234') f2 = websockets.Frame(payload=b'1234') diff --git a/test/netlib/websockets/test_masker.py b/test/netlib/websockets/test_masker.py index a06fd079..23a9b876 100644 --- a/test/netlib/websockets/test_masker.py +++ b/test/netlib/websockets/test_masker.py @@ -4,7 +4,7 @@ import pytest from netlib import websockets -class TestMasker(): +class TestMasker: @pytest.mark.parametrize("input,expected", [ ([b"a"], '00'), diff --git a/test/netlib/websockets/test_utils.py b/test/netlib/websockets/test_utils.py index 7e3f02f9..f6f1e40a 100644 --- a/test/netlib/websockets/test_utils.py +++ b/test/netlib/websockets/test_utils.py @@ -4,7 +4,7 @@ from netlib import http from netlib import websockets -class TestUtils(): +class TestUtils: def test_client_handshake_headers(self): h = websockets.client_handshake_headers(version='42') diff --git a/test/pathod/test_language_base.py b/test/pathod/test_language_base.py index 12a235e4..b8abc9ba 100644 --- a/test/pathod/test_language_base.py +++ b/test/pathod/test_language_base.py @@ -343,7 +343,7 @@ def test_unique_name(): assert b.unique_name -class test_boolean(): +class test_boolean: e = TBoolean.expr() assert e.parseString("test")[0].value assert not e.parseString("-test")[0].value diff --git a/test/pathod/test_pathod.py b/test/pathod/test_pathod.py index 69b7a604..89d7c562 100644 --- a/test/pathod/test_pathod.py +++ b/test/pathod/test_pathod.py @@ -7,7 +7,7 @@ from netlib.exceptions import HttpException, TlsException from . import tutils -class TestPathod(): +class TestPathod: def test_logging(self): s = io.StringIO() diff --git a/test/pathod/test_protocols_http2.py b/test/pathod/test_protocols_http2.py index 24353927..7300cc1d 100644 --- a/test/pathod/test_protocols_http2.py +++ b/test/pathod/test_protocols_http2.py @@ -169,7 +169,7 @@ class TestPerformClientConnectionPreface(netlib_tservers.ServerTestBase): assert protocol.connection_preface_performed -class TestClientStreamIds(): +class TestClientStreamIds: c = tcp.TCPClient(("127.0.0.1", 0)) protocol = HTTP2StateProtocol(c) @@ -183,7 +183,7 @@ class TestClientStreamIds(): assert self.protocol.current_stream_id == 5 -class TestserverstreamIds(): +class TestserverstreamIds: c = tcp.TCPClient(("127.0.0.1", 0)) protocol = HTTP2StateProtocol(c, is_server=True) @@ -230,7 +230,7 @@ class TestApplySettings(netlib_tservers.ServerTestBase): hyperframe.frame.SettingsFrame.INITIAL_WINDOW_SIZE] == 'deadbeef' -class TestCreateHeaders(): +class TestCreateHeaders: c = tcp.TCPClient(("127.0.0.1", 0)) def test_create_headers(self): @@ -267,7 +267,7 @@ class TestCreateHeaders(): assert bytes[2] == codecs.decode('00000209040000000163d5', 'hex_codec') -class TestCreateBody(): +class TestCreateBody: c = tcp.TCPClient(("127.0.0.1", 0)) def test_create_body_empty(self): @@ -422,7 +422,7 @@ class TestReadEmptyResponse(netlib_tservers.ServerTestBase): assert resp.content == b'' -class TestAssembleRequest(): +class TestAssembleRequest: c = tcp.TCPClient(("127.0.0.1", 0)) def test_request_simple(self): @@ -476,7 +476,7 @@ class TestAssembleRequest(): codecs.decode('000006000100000001666f6f626172', 'hex_codec') -class TestAssembleResponse(): +class TestAssembleResponse: c = tcp.TCPClient(("127.0.0.1", 0)) def test_simple(self): diff --git a/test/pathod/tutils.py b/test/pathod/tutils.py index 6ebf25a8..c2243578 100644 --- a/test/pathod/tutils.py +++ b/test/pathod/tutils.py @@ -23,7 +23,7 @@ def treader(bytes): return tcp.Reader(fp) -class DaemonTests(): +class DaemonTests: nohang = False ssl = False timeout = None -- cgit v1.2.3