diff options
author | Bert JW Regeer <bertjw@regeer.org> | 2020-05-06 23:54:02 -0700 |
---|---|---|
committer | Bert JW Regeer <bertjw@regeer.org> | 2020-08-15 18:55:03 -0700 |
commit | 68384558429978a6cec0645d49121d7fd53511bd (patch) | |
tree | f186a95313989291f0dd592b19b54fdb3dc708fa /tests | |
parent | dc1f15a62144974f06127c5dfe32b58eeb528efc (diff) | |
download | waitress-68384558429978a6cec0645d49121d7fd53511bd.tar.gz |
Remove object from class definition
Diffstat (limited to 'tests')
-rw-r--r-- | tests/fixtureapps/filewrapper.py | 2 | ||||
-rw-r--r-- | tests/test_buffers.py | 8 | ||||
-rw-r--r-- | tests/test_channel.py | 26 | ||||
-rw-r--r-- | tests/test_functional.py | 20 | ||||
-rw-r--r-- | tests/test_init.py | 4 | ||||
-rw-r--r-- | tests/test_parser.py | 2 | ||||
-rw-r--r-- | tests/test_proxy_headers.py | 6 | ||||
-rw-r--r-- | tests/test_receiver.py | 2 | ||||
-rw-r--r-- | tests/test_server.py | 12 | ||||
-rw-r--r-- | tests/test_task.py | 12 | ||||
-rw-r--r-- | tests/test_wasyncore.py | 12 |
11 files changed, 53 insertions, 53 deletions
diff --git a/tests/fixtureapps/filewrapper.py b/tests/fixtureapps/filewrapper.py index 63df5a6..40b7685 100644 --- a/tests/fixtureapps/filewrapper.py +++ b/tests/fixtureapps/filewrapper.py @@ -5,7 +5,7 @@ here = os.path.dirname(os.path.abspath(__file__)) fn = os.path.join(here, "groundhog1.jpg") -class KindaFilelike(object): # pragma: no cover +class KindaFilelike: # pragma: no cover def __init__(self, bytes): self.bytes = bytes diff --git a/tests/test_buffers.py b/tests/test_buffers.py index a1330ac..029acfc 100644 --- a/tests/test_buffers.py +++ b/tests/test_buffers.py @@ -413,7 +413,7 @@ class TestOverflowableBuffer(unittest.TestCase): def test_prune_with_buf(self): inst = self._makeOne() - class Buf(object): + class Buf: def prune(self): self.pruned = True @@ -477,7 +477,7 @@ class TestOverflowableBuffer(unittest.TestCase): self.buffers_to_close.remove(inst) def test_close_withbuf(self): - class Buffer(object): + class Buffer: def close(self): self.closed = True @@ -489,7 +489,7 @@ class TestOverflowableBuffer(unittest.TestCase): self.buffers_to_close.remove(inst) -class KindaFilelike(object): +class KindaFilelike: def __init__(self, bytes, close=None, tellresults=None): self.bytes = bytes self.tellresults = tellresults @@ -506,7 +506,7 @@ class Filelike(KindaFilelike): return v -class DummyBuffer(object): +class DummyBuffer: def __init__(self, length=0): self.length = length diff --git a/tests/test_channel.py b/tests/test_channel.py index 14ef5a0..1b119b9 100644 --- a/tests/test_channel.py +++ b/tests/test_channel.py @@ -29,13 +29,13 @@ class TestHTTPChannel(unittest.TestCase): inst, _, map = self._makeOneWithMap() - class DummyBuffer(object): + class DummyBuffer: chunks = [] def append(self, data): self.chunks.append(data) - class DummyData(object): + class DummyData: def __len__(self): return MAXINT @@ -367,7 +367,7 @@ class TestHTTPChannel(unittest.TestCase): inst, sock, map = self._makeOneWithMap() - class DummyHugeOutbuffer(object): + class DummyHugeOutbuffer: def __init__(self): self.length = MAXINT + 1 @@ -705,7 +705,7 @@ class TestHTTPChannel(unittest.TestCase): self.assertEqual(inst.requests, []) -class DummySock(object): +class DummySock: blocking = False closed = False @@ -732,7 +732,7 @@ class DummySock(object): return len(data) -class DummyLock(object): +class DummyLock: notified = False def __init__(self, acquirable=True): @@ -759,7 +759,7 @@ class DummyLock(object): pass -class DummyBuffer(object): +class DummyBuffer: closed = False def __init__(self, data, toraise=None): @@ -783,7 +783,7 @@ class DummyBuffer(object): self.closed = True -class DummyAdjustments(object): +class DummyAdjustments: outbuf_overflow = 1048576 outbuf_high_watermark = 1048576 inbuf_overflow = 512000 @@ -798,7 +798,7 @@ class DummyAdjustments(object): max_request_header_size = 10000 -class DummyServer(object): +class DummyServer: trigger_pulled = False adj = DummyAdjustments() @@ -813,7 +813,7 @@ class DummyServer(object): self.trigger_pulled = True -class DummyParser(object): +class DummyParser: version = 1 data = None completed = True @@ -831,7 +831,7 @@ class DummyParser(object): return len(data) -class DummyRequest(object): +class DummyRequest: error = None path = "/" version = "1.0" @@ -844,7 +844,7 @@ class DummyRequest(object): self.closed = True -class DummyLogger(object): +class DummyLogger: def __init__(self): self.exceptions = [] self.infos = [] @@ -857,13 +857,13 @@ class DummyLogger(object): self.exceptions.append(msg) -class DummyError(object): +class DummyError: code = "431" reason = "Bleh" body = "My body" -class DummyTaskClass(object): +class DummyTaskClass: wrote_header = True close_on_finish = False serviced = False diff --git a/tests/test_functional.py b/tests/test_functional.py index e894497..d8e60a4 100644 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -61,7 +61,7 @@ class FixtureTcpWSGIServer(server.TcpWSGIServer): queue.put((host, port)) -class SubprocessTests(object): +class SubprocessTests: # For nose: all tests may be ran in separate processes. _multiprocess_can_split_ = True @@ -158,7 +158,7 @@ class SleepyThreadTests(TcpTests, unittest.TestCase): self.assertEqual(result, b"notsleepy returnedsleepy returned") -class EchoTests(object): +class EchoTests: def setUp(self): from tests.fixtureapps import echo @@ -480,7 +480,7 @@ class EchoTests(object): self.assertEqual(echo.remote_host, "192.168.1.1") -class PipeliningTests(object): +class PipeliningTests: def setUp(self): from tests.fixtureapps import echo @@ -522,7 +522,7 @@ class PipeliningTests(object): self.assertEqual(response_body, expect_body) -class ExpectContinueTests(object): +class ExpectContinueTests: def setUp(self): from tests.fixtureapps import echo @@ -561,7 +561,7 @@ class ExpectContinueTests(object): self.assertEqual(response_body, tobytes(data)) -class BadContentLengthTests(object): +class BadContentLengthTests: def setUp(self): from tests.fixtureapps import badcl @@ -627,7 +627,7 @@ class BadContentLengthTests(object): self.assertEqual(int(status), 200) -class NoContentLengthTests(object): +class NoContentLengthTests: def setUp(self): from tests.fixtureapps import nocl @@ -764,7 +764,7 @@ class NoContentLengthTests(object): self.assertRaises(ConnectionClosed, read_http, fp) -class WriteCallbackTests(object): +class WriteCallbackTests: def setUp(self): from tests.fixtureapps import writecb @@ -865,7 +865,7 @@ class WriteCallbackTests(object): self.assertRaises(ConnectionClosed, read_http, fp) -class TooLargeTests(object): +class TooLargeTests: toobig = 1050 @@ -1062,7 +1062,7 @@ class TooLargeTests(object): self.assertRaises(ConnectionClosed, read_http, fp) -class InternalServerErrorTests(object): +class InternalServerErrorTests: def setUp(self): from tests.fixtureapps import error @@ -1214,7 +1214,7 @@ class InternalServerErrorTests(object): self.assertRaises(ConnectionClosed, read_http, fp) -class FileWrapperTests(object): +class FileWrapperTests: def setUp(self): from tests.fixtureapps import filewrapper diff --git a/tests/test_init.py b/tests/test_init.py index f9b91d7..c824c21 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -31,7 +31,7 @@ class Test_serve_paste(unittest.TestCase): self.assertEqual(server.ran, True) -class DummyServerFactory(object): +class DummyServerFactory: ran = False def __call__(self, app, **kw): @@ -44,7 +44,7 @@ class DummyServerFactory(object): self.ran = True -class DummyAdj(object): +class DummyAdj: verbose = False def __init__(self, kw): diff --git a/tests/test_parser.py b/tests/test_parser.py index 91837c7..ae0b263 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -721,7 +721,7 @@ class TestHTTPRequestParserIntegration(unittest.TestCase): self.assertEqual(self.parser.headers, {"CONTENT_LENGTH": "6",}) -class DummyBodyStream(object): +class DummyBodyStream: def getfile(self): return self diff --git a/tests/test_proxy_headers.py b/tests/test_proxy_headers.py index 15b4a08..1aea477 100644 --- a/tests/test_proxy_headers.py +++ b/tests/test_proxy_headers.py @@ -681,7 +681,7 @@ class TestProxyHeadersMiddleware(unittest.TestCase): self.assertIn(b'Header "X-Forwarded-Host" malformed', response.body) -class DummyLogger(object): +class DummyLogger: def __init__(self): self.logged = [] @@ -689,14 +689,14 @@ class DummyLogger(object): self.logged.append(msg % args) -class DummyApp(object): +class DummyApp: def __call__(self, environ, start_response): self.environ = environ start_response("200 OK", [("Content-Type", "text/plain")]) yield "hello" -class DummyResponse(object): +class DummyResponse: status = None headers = None body = None diff --git a/tests/test_receiver.py b/tests/test_receiver.py index b4910bb..f55aa68 100644 --- a/tests/test_receiver.py +++ b/tests/test_receiver.py @@ -226,7 +226,7 @@ class TestChunkedReceiver(unittest.TestCase): self.assertEqual(inst.error, None) -class DummyBuffer(object): +class DummyBuffer: def __init__(self, data=None): if data is None: data = [] diff --git a/tests/test_server.py b/tests/test_server.py index 9134fb8..857ba8f 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -263,7 +263,7 @@ class TestWSGIServer(unittest.TestCase): def test_maintenance(self): inst = self._makeOneWithMap() - class DummyChannel(object): + class DummyChannel: requests = [] zombie = DummyChannel() @@ -479,7 +479,7 @@ class DummySock(socket.socket): pass -class DummyTaskDispatcher(object): +class DummyTaskDispatcher: def __init__(self): self.tasks = [] @@ -490,7 +490,7 @@ class DummyTaskDispatcher(object): self.was_shutdown = True -class DummyTask(object): +class DummyTask: serviced = False start_response_called = False wrote_header = False @@ -512,12 +512,12 @@ class DummyAdj: channel_timeout = 300 -class DummyAsyncore(object): +class DummyAsyncore: def loop(self, timeout=30.0, use_poll=False, map=None, count=None): raise SystemExit -class DummyTrigger(object): +class DummyTrigger: def pull_trigger(self): self.pulled = True @@ -525,7 +525,7 @@ class DummyTrigger(object): pass -class DummyLogger(object): +class DummyLogger: def __init__(self): self.logged = [] diff --git a/tests/test_task.py b/tests/test_task.py index 6466823..10b0344 100644 --- a/tests/test_task.py +++ b/tests/test_task.py @@ -922,7 +922,7 @@ class TestErrorTask(unittest.TestCase): self.assertEqual(lines[8], b"(generated by waitress)") -class DummyTask(object): +class DummyTask: serviced = False cancelled = False @@ -933,7 +933,7 @@ class DummyTask(object): self.cancelled = True -class DummyAdj(object): +class DummyAdj: log_socket_errors = True ident = "waitress" host = "127.0.0.1" @@ -941,7 +941,7 @@ class DummyAdj(object): url_prefix = "" -class DummyServer(object): +class DummyServer: server_name = "localhost" effective_port = 80 @@ -949,7 +949,7 @@ class DummyServer(object): self.adj = DummyAdj() -class DummyChannel(object): +class DummyChannel: closed_when_done = False adj = DummyAdj() creation_time = 0 @@ -970,7 +970,7 @@ class DummyChannel(object): return len(data) -class DummyParser(object): +class DummyParser: version = "1.0" command = "GET" path = "/" @@ -990,7 +990,7 @@ def filter_lines(s): return list(filter(None, s.split(b"\r\n"))) -class DummyLogger(object): +class DummyLogger: def __init__(self): self.logged = [] diff --git a/tests/test_wasyncore.py b/tests/test_wasyncore.py index 9c23509..d7c8ed3 100644 --- a/tests/test_wasyncore.py +++ b/tests/test_wasyncore.py @@ -33,7 +33,7 @@ else: TESTFN = "{}_{}_tmp".format(TESTFN, os.getpid()) -class DummyLogger(object): # pragma: no cover +class DummyLogger: # pragma: no cover def __init__(self): self.messages = [] @@ -41,7 +41,7 @@ class DummyLogger(object): # pragma: no cover self.messages.append((severity, message)) -class WarningsRecorder(object): # pragma: no cover +class WarningsRecorder: # pragma: no cover """Convenience wrapper for the warnings list returned on entry to the warnings.catch_warnings() context manager. """ @@ -1680,7 +1680,7 @@ class Test_close_all(unittest.TestCase): self.assertRaises(RuntimeError, self._callFUT, map) -class DummyDispatcher(object): +class DummyDispatcher: read_event_handled = False write_event_handled = False expt_event_handled = False @@ -1723,7 +1723,7 @@ class DummyDispatcher(object): raise self.exc -class DummyTime(object): +class DummyTime: def __init__(self): self.sleepvals = [] @@ -1731,7 +1731,7 @@ class DummyTime(object): self.sleepvals.append(val) -class DummySelect(object): +class DummySelect: error = select.error def __init__(self, exc=None, pollster=None): @@ -1748,7 +1748,7 @@ class DummySelect(object): return self.pollster -class DummyPollster(object): +class DummyPollster: def __init__(self, exc=None): self.polled = [] self.exc = exc |