diff options
author | Bert JW Regeer <bertjw@regeer.org> | 2020-05-06 23:07:57 -0700 |
---|---|---|
committer | Bert JW Regeer <bertjw@regeer.org> | 2020-11-28 12:19:54 -0800 |
commit | c53e6fa20707b4521bb9c523d3400007595cf7cf (patch) | |
tree | da509b1e7f194b93d5dbb08279f42cf951b6fd83 | |
parent | 8a1c763b3c117c6eb9ff728d951a2b9b17e567fe (diff) | |
download | webob-c53e6fa20707b4521bb9c523d3400007595cf7cf.tar.gz |
Drop object from class definition
-rw-r--r-- | src/webob/acceptparse.py | 8 | ||||
-rw-r--r-- | src/webob/byterange.py | 4 | ||||
-rw-r--r-- | src/webob/cachecontrol.py | 6 | ||||
-rw-r--r-- | src/webob/client.py | 2 | ||||
-rw-r--r-- | src/webob/cookies.py | 8 | ||||
-rw-r--r-- | src/webob/dec.py | 6 | ||||
-rw-r--r-- | src/webob/etag.py | 10 | ||||
-rw-r--r-- | src/webob/exc.py | 4 | ||||
-rw-r--r-- | src/webob/multidict.py | 2 | ||||
-rw-r--r-- | src/webob/request.py | 6 | ||||
-rw-r--r-- | src/webob/response.py | 8 | ||||
-rw-r--r-- | src/webob/static.py | 6 | ||||
-rw-r--r-- | tests/test_acceptparse.py | 180 | ||||
-rw-r--r-- | tests/test_cachecontrol.py | 14 | ||||
-rw-r--r-- | tests/test_client.py | 8 | ||||
-rw-r--r-- | tests/test_compat.py | 2 | ||||
-rw-r--r-- | tests/test_cookies.py | 12 | ||||
-rw-r--r-- | tests/test_datetime_utils.py | 2 | ||||
-rw-r--r-- | tests/test_dec.py | 2 | ||||
-rw-r--r-- | tests/test_descriptors.py | 4 | ||||
-rw-r--r-- | tests/test_etag.py | 12 | ||||
-rw-r--r-- | tests/test_exc.py | 4 | ||||
-rw-r--r-- | tests/test_misc.py | 8 | ||||
-rw-r--r-- | tests/test_multidict.py | 6 | ||||
-rw-r--r-- | tests/test_request.py | 28 | ||||
-rw-r--r-- | tests/test_response.py | 4 | ||||
-rw-r--r-- | tests/test_static.py | 2 | ||||
-rw-r--r-- | tests/test_util.py | 2 |
28 files changed, 180 insertions, 180 deletions
diff --git a/src/webob/acceptparse.py b/src/webob/acceptparse.py index 0ac3a5b..19443b6 100644 --- a/src/webob/acceptparse.py +++ b/src/webob/acceptparse.py @@ -113,7 +113,7 @@ class AcceptOffer(namedtuple("AcceptOffer", ["type", "subtype", "params"])): return Accept._form_media_range(value, self.params) -class Accept(object): +class Accept: """ Represent an ``Accept`` header. @@ -1790,7 +1790,7 @@ def accept_property(): return property(fget, fset, fdel, textwrap.dedent(doc)) -class AcceptCharset(object): +class AcceptCharset: """ Represent an ``Accept-Charset`` header. @@ -2784,7 +2784,7 @@ def accept_charset_property(): return property(fget, fset, fdel, textwrap.dedent(doc)) -class AcceptEncoding(object): +class AcceptEncoding: """ Represent an ``Accept-Encoding`` header. @@ -3827,7 +3827,7 @@ def accept_encoding_property(): return property(fget, fset, fdel, textwrap.dedent(doc)) -class AcceptLanguage(object): +class AcceptLanguage: """ Represent an ``Accept-Language`` header. diff --git a/src/webob/byterange.py b/src/webob/byterange.py index 435282b..44db453 100644 --- a/src/webob/byterange.py +++ b/src/webob/byterange.py @@ -6,7 +6,7 @@ _rx_range = re.compile(r"bytes *= *(\d*) *- *(\d*)", flags=re.I) _rx_content_range = re.compile(r"bytes (?:(\d+)-(\d+)|[*])/(?:(\d+)|[*])") -class Range(object): +class Range: """ Represents the Range header. """ @@ -85,7 +85,7 @@ class Range(object): return cls(start, end) -class ContentRange(object): +class ContentRange: """ Represents the Content-Range header diff --git a/src/webob/cachecontrol.py b/src/webob/cachecontrol.py index 1278329..1029344 100644 --- a/src/webob/cachecontrol.py +++ b/src/webob/cachecontrol.py @@ -63,7 +63,7 @@ token_re = re.compile(r'([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))? need_quote_re = re.compile(r"[^a-zA-Z0-9._-]") -class exists_property(object): +class exists_property: """ Represents a property that either is listed in the Cache-Control header, or is not listed (has no value) @@ -95,7 +95,7 @@ class exists_property(object): self.__set__(obj, False) -class value_property(object): +class value_property: """ Represents a property that has a value in the Cache-Control header. @@ -139,7 +139,7 @@ class value_property(object): del obj.properties[self.prop] -class CacheControl(object): +class CacheControl: """ Represents the Cache-Control header. diff --git a/src/webob/client.py b/src/webob/client.py index 89b9223..6ec7742 100644 --- a/src/webob/client.py +++ b/src/webob/client.py @@ -96,7 +96,7 @@ class SendRequest: except socket.timeout: resp = exc.HTTPGatewayTimeout() return resp(environ, start_response) - except (socket.error, socket.gaierror) as e: + except (OSError, socket.gaierror) as e: if (isinstance(e, socket.error) and e.args[0] == -2) or ( isinstance(e, socket.gaierror) and e.args[0] == 8 ): diff --git a/src/webob/cookies.py b/src/webob/cookies.py index b387211..f4c77e6 100644 --- a/src/webob/cookies.py +++ b/src/webob/cookies.py @@ -613,7 +613,7 @@ def make_cookie( return morsel.serialize() -class JSONSerializer(object): +class JSONSerializer: """ A serializer which uses `json.dumps`` and ``json.loads``""" def dumps(self, appstruct): @@ -626,7 +626,7 @@ class JSONSerializer(object): return json.loads(text_(bstruct, encoding="utf-8")) -class Base64Serializer(object): +class Base64Serializer: """ A serializer which uses base64 to encode/decode data""" def __init__(self, serializer=None): @@ -660,7 +660,7 @@ class Base64Serializer(object): return self.serializer.loads(cstruct) -class SignedSerializer(object): +class SignedSerializer: """ A helper to cryptographically sign arbitrary content using HMAC. @@ -746,7 +746,7 @@ class SignedSerializer(object): _default = object() -class CookieProfile(object): +class CookieProfile: """ A helper class that helps bring some sanity to the insanity that is cookie handling. diff --git a/src/webob/dec.py b/src/webob/dec.py index 237266a..02ec255 100644 --- a/src/webob/dec.py +++ b/src/webob/dec.py @@ -13,7 +13,7 @@ from webob.util import bytes_ __all__ = ["wsgify"] -class wsgify(object): +class wsgify: """Turns a request-taking, response-returning function into a WSGI app @@ -295,7 +295,7 @@ class wsgify(object): return args, kwargs -class _UnboundMiddleware(object): +class _UnboundMiddleware: """A `wsgify.middleware` invocation that has not yet wrapped a middleware function; the intermediate object when you do something like ``@wsgify.middleware(RequestClass=Foo)`` @@ -316,7 +316,7 @@ class _UnboundMiddleware(object): return self.wrapper_class.middleware(func, app=app, **self.kw) -class _MiddlewareFactory(object): +class _MiddlewareFactory: """A middleware that has not yet been bound to an application or configured. """ diff --git a/src/webob/etag.py b/src/webob/etag.py index e0ee8d5..6e91d45 100644 --- a/src/webob/etag.py +++ b/src/webob/etag.py @@ -34,7 +34,7 @@ def etag_property(key, default, rfc_section, strong=True): return property(fget, fset, fdel, doc=doc) -class _AnyETag(object): +class _AnyETag: """ Represents an ETag of *, or a missing ETag when matching is 'safe' """ @@ -57,7 +57,7 @@ class _AnyETag(object): AnyETag = _AnyETag() -class _NoETag(object): +class _NoETag: """ Represents a missing ETag when matching is unsafe """ @@ -83,7 +83,7 @@ NoETag = _NoETag() # TODO: convert into a simple tuple -class ETagMatcher(object): +class ETagMatcher: def __init__(self, etags): self.etags = etags @@ -114,7 +114,7 @@ class ETagMatcher(object): return ", ".join(map('"%s"'.__mod__, self.etags)) -class IfRange(object): +class IfRange: def __init__(self, etag): self.etag = etag @@ -149,7 +149,7 @@ class IfRange(object): __bool__ = __nonzero__ # python 3 -class IfRangeDate(object): +class IfRangeDate: def __init__(self, date): self.date = date diff --git a/src/webob/exc.py b/src/webob/exc.py index 5ca71b9..826ce05 100644 --- a/src/webob/exc.py +++ b/src/webob/exc.py @@ -181,7 +181,7 @@ br_re = re.compile(r"<br.*?>", re.I | re.S) comment_re = re.compile(r"<!--|-->") -class _lazified(object): +class _lazified: def __init__(self, func, value): self.func = func self.value = value @@ -1303,7 +1303,7 @@ class HTTPNetworkAuthenticationRequired(HTTPServerError): explanation = "Network authentication is required" -class HTTPExceptionMiddleware(object): +class HTTPExceptionMiddleware: """ Middleware that catches exceptions in the sub-application. This does not catch exceptions in the app_iter; only during the initial diff --git a/src/webob/multidict.py b/src/webob/multidict.py index 38ca203..0c148e7 100644 --- a/src/webob/multidict.py +++ b/src/webob/multidict.py @@ -444,7 +444,7 @@ class NestedMultiDict(MultiDict): __iter__ = keys -class NoVars(object): +class NoVars: """ Represents no variables; used when no variables are applicable. diff --git a/src/webob/request.py b/src/webob/request.py index cb33d52..7408255 100644 --- a/src/webob/request.py +++ b/src/webob/request.py @@ -80,7 +80,7 @@ _LATIN_ENCODINGS = ( ) -class BaseRequest(object): +class BaseRequest: # The limit after which request bodies should be stored on disk # if they are read in (under this, and the request body is stored # in memory): @@ -1478,7 +1478,7 @@ class BaseRequest(object): return obj -class AdhocAttrMixin(object): +class AdhocAttrMixin: _setattr_stacklevel = 3 def __setattr__(self, attr, value, DEFAULT=DEFAULT): @@ -1741,7 +1741,7 @@ def _is_utf8(charset): return charset.lower().replace("-", "") == "utf8" -class Transcoder(object): +class Transcoder: def __init__(self, charset, errors="strict"): self.charset = charset # source charset self.errors = errors # unicode errors diff --git a/src/webob/response.py b/src/webob/response.py index f5e59d4..435ea62 100644 --- a/src/webob/response.py +++ b/src/webob/response.py @@ -57,7 +57,7 @@ _gzip_header = b"\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\xff" _marker = object() -class Response(object): +class Response: """ Represents a WSGI response. @@ -1500,7 +1500,7 @@ def iter_file(file, block_size=1 << 18): # 256Kb yield data -class ResponseBodyFile(object): +class ResponseBodyFile: mode = "wb" closed = False @@ -1544,7 +1544,7 @@ class ResponseBodyFile(object): return sum([len(chunk) for chunk in self.response.app_iter]) -class AppIterRange(object): +class AppIterRange: """ Wraps an ``app_iter``, returning just a range of bytes. """ @@ -1605,7 +1605,7 @@ class AppIterRange(object): iter_close(self.app_iter) -class EmptyResponse(object): +class EmptyResponse: """ An empty WSGI response. diff --git a/src/webob/static.py b/src/webob/static.py index 52ad566..27f1324 100644 --- a/src/webob/static.py +++ b/src/webob/static.py @@ -16,7 +16,7 @@ mimetypes.add_type("image/x-icon", ".ico") # not among defaults BLOCK_SIZE = 1 << 16 -class FileApp(object): +class FileApp: """An application that will send the file at the given filename. Adds a mime type based on `mimetypes.guess_type()`. @@ -62,7 +62,7 @@ class FileApp(object): ).conditional_response_app -class FileIter(object): +class FileIter: def __init__(self, file): self.file = file @@ -104,7 +104,7 @@ class FileIter(object): __iter__ = app_iter_range -class DirectoryApp(object): +class DirectoryApp: """An application that serves up the files in a given directory. This will serve index files (by default ``index.html``), or set diff --git a/tests/test_acceptparse.py b/tests/test_acceptparse.py index e5ff5ea..725919a 100644 --- a/tests/test_acceptparse.py +++ b/tests/test_acceptparse.py @@ -40,7 +40,7 @@ IGNORE_ITER = "ignore:.*__iter__.*" IGNORE_MIMEACCEPT = "ignore:.*MIMEAccept.*" -class Test_ItemNWeightRe(object): +class Test_ItemNWeightRe: @pytest.mark.parametrize( "header_value", [ @@ -95,7 +95,7 @@ class Test_ItemNWeightRe(object): assert re.match("^" + regex + "$", header_value, re.VERBOSE).groups() == groups -class Test_List1OrMoreCompiledRe(object): +class Test_List1OrMoreCompiledRe: @pytest.mark.parametrize( "header_value", [ @@ -138,7 +138,7 @@ class Test_List1OrMoreCompiledRe(object): assert regex.match(header_value) -class TestAccept(object): +class TestAccept: @pytest.mark.parametrize( "value", [ @@ -465,7 +465,7 @@ class TestAccept(object): Accept.parse_offer(offer) -class TestAcceptValidHeader(object): +class TestAcceptValidHeader: def test_parse__inherited(self): returned = AcceptValidHeader.parse( value=( @@ -541,7 +541,7 @@ class TestAcceptValidHeader(object): def test___add___other_type_with_invalid___str__(self, str_): left_operand = AcceptValidHeader(header_value="text/html") - class Other(object): + class Other: def __str__(self): return str_ @@ -562,7 +562,7 @@ class TestAcceptValidHeader(object): def test___add___other_type_with_valid___str___empty(self): left_operand = AcceptValidHeader(header_value=",\t ,i/j, k/l;q=0.333,") - class Other(object): + class Other: def __str__(self): return "" @@ -655,7 +655,7 @@ class TestAcceptValidHeader(object): def test___add___other_type_with_valid___str___not_empty(self): header = ",\t ,i/j, k/l;q=0.333," - class Other(object): + class Other: def __str__(self): return "a/b;q=0.5, c/d;p1=1;q=0, e/f, g/h;p1=1;q=1;e1=1" @@ -759,7 +759,7 @@ class TestAcceptValidHeader(object): def test___radd___other_type_with_invalid___str__(self, str_): right_operand = AcceptValidHeader(header_value="a/b") - class Other(object): + class Other: def __str__(self): return str_ @@ -779,7 +779,7 @@ class TestAcceptValidHeader(object): def test___radd___other_type_with_valid___str___empty(self): right_operand = AcceptValidHeader(header_value=",\t ,i/j, k/l;q=0.333,") - class Other(object): + class Other: def __str__(self): return "" @@ -872,7 +872,7 @@ class TestAcceptValidHeader(object): def test___radd___other_type_with_valid___str___not_empty(self): header = ",\t ,i/j, k/l;q=0.333," - class Other(object): + class Other: def __str__(self): return "a/b;q=0.5, c/d;p1=1;q=0, e/f, g/h;p1=1;q=1;e1=1" @@ -1238,7 +1238,7 @@ class TestAcceptValidHeader(object): assert accept.quality("foo/bar") is None -class TestAcceptNoHeader(object): +class TestAcceptNoHeader: def test_parse__inherited(self): returned = AcceptNoHeader.parse( value=( @@ -1290,7 +1290,7 @@ class TestAcceptNoHeader(object): def test___add___other_type_with_invalid___str__(self, str_): left_operand = AcceptNoHeader() - class Other(object): + class Other: def __str__(self): return str_ @@ -1308,7 +1308,7 @@ class TestAcceptNoHeader(object): def test___add___other_type_with_valid___str___empty(self): left_operand = AcceptNoHeader() - class Other(object): + class Other: def __str__(self): return "" @@ -1397,7 +1397,7 @@ class TestAcceptNoHeader(object): assert result.header_value == value_as_header def test___add___other_type_with_valid___str___not_empty(self): - class Other(object): + class Other: def __str__(self): return "a/b;q=0.5, c/d;p1=1;q=0, e/f, g/h;p1=1;q=1;e1=1" @@ -1482,7 +1482,7 @@ class TestAcceptNoHeader(object): def test___radd___other_type_with_invalid___str__(self, str_): right_operand = AcceptNoHeader() - class Other(object): + class Other: def __str__(self): return str_ @@ -1497,7 +1497,7 @@ class TestAcceptNoHeader(object): assert result.header_value == "" def test___radd___other_type_with_valid___str___empty(self): - class Other(object): + class Other: def __str__(self): return "" @@ -1586,7 +1586,7 @@ class TestAcceptNoHeader(object): assert result.header_value == value_as_header def test___radd___other_type_with_valid___str___not_empty(self): - class Other(object): + class Other: def __str__(self): return "a/b;q=0.5, c/d;p1=1;q=0, e/f, g/h;p1=1;q=1;e1=1" @@ -1656,7 +1656,7 @@ class TestAcceptNoHeader(object): assert returned == 1.0 -class TestAcceptInvalidHeader(object): +class TestAcceptInvalidHeader: def test_parse__inherited(self): returned = AcceptInvalidHeader.parse( value=( @@ -1709,7 +1709,7 @@ class TestAcceptInvalidHeader(object): def test___add___other_type_with_invalid___str__(self, str_): left_operand = AcceptInvalidHeader(header_value="invalid header") - class Other(object): + class Other: def __str__(self): return str_ @@ -1727,7 +1727,7 @@ class TestAcceptInvalidHeader(object): def test___add___other_type_with_valid___str___empty(self): left_operand = AcceptInvalidHeader(header_value=", ") - class Other(object): + class Other: def __str__(self): return "" @@ -1816,7 +1816,7 @@ class TestAcceptInvalidHeader(object): assert result.header_value == value_as_header def test___add___other_type_with_valid___str___not_empty(self): - class Other(object): + class Other: def __str__(self): return "a/b;q=0.5, c/d;p1=1;q=0, e/f, g/h;p1=1;q=1;e1=1" @@ -1900,7 +1900,7 @@ class TestAcceptInvalidHeader(object): def test___radd___other_type_with_invalid___str__(self, str_): right_operand = AcceptInvalidHeader(header_value=", ") - class Other(object): + class Other: def __str__(self): return str_ @@ -1917,7 +1917,7 @@ class TestAcceptInvalidHeader(object): def test___radd___other_type_with_valid___str___empty(self): right_operand = AcceptInvalidHeader(header_value="invalid header") - class Other(object): + class Other: def __str__(self): return "" @@ -2006,7 +2006,7 @@ class TestAcceptInvalidHeader(object): assert result.header_value == value_as_header def test___radd___other_type_with_valid___str___not_empty(self): - class Other(object): + class Other: def __str__(self): return "a/b;q=0.5, c/d;p1=1;q=0, e/f, g/h;p1=1;q=1;e1=1" @@ -2079,7 +2079,7 @@ class TestAcceptInvalidHeader(object): assert returned == 1.0 -class TestCreateAcceptHeader(object): +class TestCreateAcceptHeader: def test_header_value_is_None(self): header_value = None returned = create_accept_header(header_value=header_value) @@ -2108,7 +2108,7 @@ class TestCreateAcceptHeader(object): assert returned2._header_value == returned._header_value -class TestAcceptProperty(object): +class TestAcceptProperty: def test_fget_header_is_valid(self): header_value = 'text/html;p1="1";p2=v2;q=0.9;e1="1";e2, audio/basic' request = Request.blank("/", environ={"HTTP_ACCEPT": header_value}) @@ -2243,7 +2243,7 @@ class TestAcceptProperty(object): request = Request.blank("/", environ={"HTTP_ACCEPT": "text/html"}) property_ = accept_property() - class Other(object): + class Other: def __str__(self): return header_value @@ -2287,7 +2287,7 @@ class TestAcceptProperty(object): assert "HTTP_ACCEPT" not in request.environ -class TestAcceptCharset(object): +class TestAcceptCharset: @pytest.mark.parametrize( "value", [ @@ -2348,7 +2348,7 @@ class TestAcceptCharset(object): assert list_of_returned == expected_list -class TestAcceptCharsetValidHeader(object): +class TestAcceptCharsetValidHeader: def test_parse__inherited(self): returned = AcceptCharsetValidHeader.parse( value=",iso-8859-5 ; q=0.333 , ,utf-8,unicode-1-1 ;q=0.90," @@ -2404,7 +2404,7 @@ class TestAcceptCharsetValidHeader(object): def test___add___other_type_with_invalid___str__(self, str_): left_operand = AcceptCharsetValidHeader(header_value="iso-8859-5") - class Other(object): + class Other: def __str__(self): return str_ @@ -2444,7 +2444,7 @@ class TestAcceptCharsetValidHeader(object): def test___add___other_type_with_valid___str__(self): left_operand = AcceptCharsetValidHeader(header_value=",\t ,iso-8859-5;q=0.333,") - class Other(object): + class Other: def __str__(self): return "UTF-7;q=0.5, unicode-1-1;q=0, UTF-8" @@ -2534,7 +2534,7 @@ class TestAcceptCharsetValidHeader(object): def test___radd___other_type_with_invalid___str__(self, str_): right_operand = AcceptCharsetValidHeader(header_value="iso-8859-5") - class Other(object): + class Other: def __str__(self): return str_ @@ -2579,7 +2579,7 @@ class TestAcceptCharsetValidHeader(object): header_value=",\t ,iso-8859-5;q=0.333," ) - class Other(object): + class Other: def __str__(self): return "UTF-7;q=0.5, unicode-1-1;q=0, UTF-8" @@ -2704,7 +2704,7 @@ class TestAcceptCharsetValidHeader(object): assert accept.quality("iso-8859-5") is None -class TestAcceptCharsetNoHeader(object): +class TestAcceptCharsetNoHeader: def test_parse__inherited(self): returned = AcceptCharsetNoHeader.parse( value=",iso-8859-5 ; q=0.333 , ,utf-8,unicode-1-1 ;q=0.90," @@ -2743,7 +2743,7 @@ class TestAcceptCharsetNoHeader(object): def test___add___other_type_with_invalid___str__(self, str_): left_operand = AcceptCharsetNoHeader() - class Other(object): + class Other: def __str__(self): return str_ @@ -2778,7 +2778,7 @@ class TestAcceptCharsetNoHeader(object): assert result.header_value == value_as_header def test___add___other_type_with_valid___str__(self): - class Other(object): + class Other: def __str__(self): return "UTF-7;q=0.5, unicode-1-1;q=0, UTF-8" @@ -2847,7 +2847,7 @@ class TestAcceptCharsetNoHeader(object): def test___radd___other_type_with_invalid___str__(self, str_): right_operand = AcceptCharsetNoHeader() - class Other(object): + class Other: def __str__(self): return str_ @@ -2882,7 +2882,7 @@ class TestAcceptCharsetNoHeader(object): assert result.header_value == value_as_header def test___radd___other_type_with_valid___str__(self): - class Other(object): + class Other: def __str__(self): return "UTF-7;q=0.5, unicode-1-1;q=0, UTF-8" @@ -2928,7 +2928,7 @@ class TestAcceptCharsetNoHeader(object): assert returned == 1.0 -class TestAcceptCharsetInvalidHeader(object): +class TestAcceptCharsetInvalidHeader: def test_parse__inherited(self): returned = AcceptCharsetInvalidHeader.parse( value=",iso-8859-5 ; q=0.333 , ,utf-8,unicode-1-1 ;q=0.90," @@ -2963,7 +2963,7 @@ class TestAcceptCharsetInvalidHeader(object): @pytest.mark.parametrize("str_", ["", "UTF/8"]) def test___add___other_type_with_invalid___str__(self, str_): - class Other(object): + class Other: def __str__(self): return str_ @@ -2997,7 +2997,7 @@ class TestAcceptCharsetInvalidHeader(object): assert result.header_value == value_as_header def test___add___other_type_valid_header_value(self): - class Other(object): + class Other: def __str__(self): return "UTF-7;q=0.5, unicode-1-1;q=0, UTF-8" @@ -3057,7 +3057,7 @@ class TestAcceptCharsetInvalidHeader(object): @pytest.mark.parametrize("str_", ["", "UTF/8"]) def test___radd___other_type_with_invalid___str__(self, str_): - class Other(object): + class Other: def __str__(self): return str_ @@ -3091,7 +3091,7 @@ class TestAcceptCharsetInvalidHeader(object): assert result.header_value == value_as_header def test___radd___other_type_valid_header_value(self): - class Other(object): + class Other: def __str__(self): return "UTF-7;q=0.5, unicode-1-1;q=0, UTF-8" @@ -3137,7 +3137,7 @@ class TestAcceptCharsetInvalidHeader(object): assert returned == 1.0 -class TestCreateAcceptCharsetHeader(object): +class TestCreateAcceptCharsetHeader: def test_header_value_is_valid(self): header_value = "iso-8859-5, unicode-1-1;q=0.8" returned = create_accept_charset_header(header_value=header_value) @@ -3166,7 +3166,7 @@ class TestCreateAcceptCharsetHeader(object): assert returned2._header_value == returned._header_value -class TestAcceptCharsetProperty(object): +class TestAcceptCharsetProperty: def test_fget_header_is_None(self): request = Request.blank("/", environ={"HTTP_ACCEPT_CHARSET": None}) property_ = accept_charset_property() @@ -3238,7 +3238,7 @@ class TestAcceptCharsetProperty(object): request = Request.blank("/", environ={"HTTP_ACCEPT_CHARSET": ""}) property_ = accept_charset_property() - class Other(object): + class Other: def __str__(self): return "utf-8;q=0.5, iso-8859-5;q=0, utf-7" @@ -3286,7 +3286,7 @@ class TestAcceptCharsetProperty(object): assert "HTTP_ACCEPT_CHARSET" not in request.environ -class TestAcceptEncoding(object): +class TestAcceptEncoding: @pytest.mark.parametrize( "value", [ @@ -3344,7 +3344,7 @@ class TestAcceptEncoding(object): assert list_of_returned == expected_list -class TestAcceptEncodingValidHeader(object): +class TestAcceptEncodingValidHeader: def test_parse__inherited(self): returned = AcceptEncodingValidHeader.parse( value=",,\t gzip;q=1.0, identity; q=0.5, *;q=0 \t ," @@ -3385,7 +3385,7 @@ class TestAcceptEncodingValidHeader(object): def test___add___other_type_with_invalid___str__(self): left_operand = AcceptEncodingValidHeader(header_value="gzip") - class Other(object): + class Other: def __str__(self): return ", " @@ -3406,7 +3406,7 @@ class TestAcceptEncodingValidHeader(object): def test___add___other_type_with_valid___str___empty(self): left_operand = AcceptEncodingValidHeader(header_value="gzip") - class Other(object): + class Other: def __str__(self): return "" @@ -3444,7 +3444,7 @@ class TestAcceptEncodingValidHeader(object): def test___add___other_type_with_valid___str___not_empty(self): header = ",\t ,gzip, identity;q=0.333," - class Other(object): + class Other: def __str__(self): return "compress;q=0.5, deflate;q=0, *" @@ -3532,7 +3532,7 @@ class TestAcceptEncodingValidHeader(object): def test___radd___other_type_with_invalid___str__(self): right_operand = AcceptEncodingValidHeader(header_value="gzip") - class Other(object): + class Other: def __str__(self): return ", " @@ -3552,7 +3552,7 @@ class TestAcceptEncodingValidHeader(object): def test___radd___other_type_with_valid___str___empty(self): right_operand = AcceptEncodingValidHeader(header_value="gzip") - class Other(object): + class Other: def __str__(self): return "" @@ -3590,7 +3590,7 @@ class TestAcceptEncodingValidHeader(object): def test___radd___other_type_with_valid___str___not_empty(self): header = ",\t ,gzip, identity;q=0.333," - class Other(object): + class Other: def __str__(self): return "compress;q=0.5, deflate;q=0, *" @@ -3714,7 +3714,7 @@ class TestAcceptEncodingValidHeader(object): assert accept.quality("compress") is None -class TestAcceptEncodingNoHeader(object): +class TestAcceptEncodingNoHeader: def test_parse__inherited(self): returned = AcceptEncodingNoHeader.parse( value=",,\t gzip;q=1.0, identity; q=0.5, *;q=0 \t ," @@ -3743,7 +3743,7 @@ class TestAcceptEncodingNoHeader(object): def test___add___other_type_with_invalid___str__(self): left_operand = AcceptEncodingNoHeader() - class Other(object): + class Other: def __str__(self): return ", " @@ -3761,7 +3761,7 @@ class TestAcceptEncodingNoHeader(object): def test___add___other_type_with_valid___str___empty(self): left_operand = AcceptEncodingNoHeader() - class Other(object): + class Other: def __str__(self): return "" @@ -3795,7 +3795,7 @@ class TestAcceptEncodingNoHeader(object): assert result.header_value == value_as_header def test___add___other_type_with_valid___str___not_empty(self): - class Other(object): + class Other: def __str__(self): return "compress;q=0.5, deflate;q=0, *" @@ -3867,7 +3867,7 @@ class TestAcceptEncodingNoHeader(object): def test___radd___other_type_with_invalid___str__(self): right_operand = AcceptEncodingNoHeader() - class Other(object): + class Other: def __str__(self): return ", " @@ -3882,7 +3882,7 @@ class TestAcceptEncodingNoHeader(object): assert result.header_value == "" def test___radd___other_type_with_valid___str___empty(self): - class Other(object): + class Other: def __str__(self): return "" @@ -3916,7 +3916,7 @@ class TestAcceptEncodingNoHeader(object): assert result.header_value == value_as_header def test___radd___other_type_with_valid___str___not_empty(self): - class Other(object): + class Other: def __str__(self): return "compress;q=0.5, deflate;q=0, *" @@ -3962,7 +3962,7 @@ class TestAcceptEncodingNoHeader(object): assert returned == 1.0 -class TestAcceptEncodingInvalidHeader(object): +class TestAcceptEncodingInvalidHeader: def test_parse__inherited(self): returned = AcceptEncodingInvalidHeader.parse( value=",,\t gzip;q=1.0, identity; q=0.5, *;q=0 \t ," @@ -3992,7 +3992,7 @@ class TestAcceptEncodingInvalidHeader(object): def test___add___other_type_with_invalid___str__(self): left_operand = AcceptEncodingInvalidHeader(header_value="invalid header") - class Other(object): + class Other: def __str__(self): return ", " @@ -4010,7 +4010,7 @@ class TestAcceptEncodingInvalidHeader(object): def test___add___other_type_with_valid___str___empty(self): left_operand = AcceptEncodingInvalidHeader(header_value=", ") - class Other(object): + class Other: def __str__(self): return "" @@ -4044,7 +4044,7 @@ class TestAcceptEncodingInvalidHeader(object): assert result.header_value == value_as_header def test___add___other_type_with_valid___str___not_empty(self): - class Other(object): + class Other: def __str__(self): return "*, compress;q=0.5, deflate;q=0" @@ -4115,7 +4115,7 @@ class TestAcceptEncodingInvalidHeader(object): def test___radd___other_type_with_invalid___str__(self): right_operand = AcceptEncodingInvalidHeader(header_value="gzip;q= 1") - class Other(object): + class Other: def __str__(self): return ", " @@ -4132,7 +4132,7 @@ class TestAcceptEncodingInvalidHeader(object): def test___radd___other_type_with_valid___str___empty(self): right_operand = AcceptEncodingInvalidHeader(header_value=", ") - class Other(object): + class Other: def __str__(self): return "" @@ -4166,7 +4166,7 @@ class TestAcceptEncodingInvalidHeader(object): assert result.header_value == value_as_header def test___radd___other_type_with_valid___str___not_empty(self): - class Other(object): + class Other: def __str__(self): return "compress;q=0.5, deflate;q=0, *" @@ -4212,7 +4212,7 @@ class TestAcceptEncodingInvalidHeader(object): assert returned == 1.0 -class TestCreateAcceptEncodingHeader(object): +class TestCreateAcceptEncodingHeader: def test_header_value_is_None(self): header_value = None returned = create_accept_encoding_header(header_value=header_value) @@ -4241,7 +4241,7 @@ class TestCreateAcceptEncodingHeader(object): assert returned2._header_value == returned._header_value -class TestAcceptEncodingProperty(object): +class TestAcceptEncodingProperty: def test_fget_header_is_None(self): request = Request.blank("/", environ={"HTTP_ACCEPT_ENCODING": None}) property_ = accept_encoding_property() @@ -4310,7 +4310,7 @@ class TestAcceptEncodingProperty(object): request = Request.blank("/", environ={"HTTP_ACCEPT_ENCODING": ""}) property_ = accept_encoding_property() - class Other(object): + class Other: def __str__(self): return "gzip;q=0.5, compress;q=0, deflate" @@ -4358,7 +4358,7 @@ class TestAcceptEncodingProperty(object): assert "HTTP_ACCEPT_ENCODING" not in request.environ -class TestAcceptLanguage(object): +class TestAcceptLanguage: @pytest.mark.parametrize( "value", [ @@ -4427,7 +4427,7 @@ class TestAcceptLanguage(object): assert list_of_returned == expected_list -class TestAcceptLanguageValidHeader(object): +class TestAcceptLanguageValidHeader: @pytest.mark.parametrize("header_value", ["", ", da;q=0.2, en-gb;q=0.3 "]) def test___init___invalid_header(self, header_value): with pytest.raises(ValueError): @@ -4485,7 +4485,7 @@ class TestAcceptLanguageValidHeader(object): def test___add___other_type_with_invalid___str__(self, str_): left_operand = AcceptLanguageValidHeader(header_value="en") - class Other(object): + class Other: def __str__(self): return str_ @@ -4513,7 +4513,7 @@ class TestAcceptLanguageValidHeader(object): def test___add___other_type_with_valid___str__(self): header = ",\t ,de, zh-Hans;q=0.333," - class Other(object): + class Other: def __str__(self): return "en-gb;q=0.5, fr;q=0, es" @@ -4635,7 +4635,7 @@ class TestAcceptLanguageValidHeader(object): def test___radd___other_type_with_invalid___str__(self, str_): right_operand = AcceptLanguageValidHeader(header_value="en") - class Other(object): + class Other: def __str__(self): return str_ @@ -4668,7 +4668,7 @@ class TestAcceptLanguageValidHeader(object): header_value=",\t ,de, zh-Hans;q=0.333," ) - class Other(object): + class Other: def __str__(self): return "en-gb;q=0.5, fr;q=0, es" @@ -5245,7 +5245,7 @@ class TestAcceptLanguageValidHeader(object): assert returned == expected_returned -class TestAcceptLanguageNoHeader(object): +class TestAcceptLanguageNoHeader: def test___init__(self): instance = AcceptLanguageNoHeader() assert instance.header_value is None @@ -5273,7 +5273,7 @@ class TestAcceptLanguageNoHeader(object): def test___add___other_type_with_invalid___str__(self, str_): left_operand = AcceptLanguageNoHeader() - class Other(object): + class Other: def __str__(self): return str_ @@ -5296,7 +5296,7 @@ class TestAcceptLanguageNoHeader(object): assert result.header_value == value_as_header def test___add___other_type_with_valid___str__(self): - class Other(object): + class Other: def __str__(self): return "en-gb;q=0.5, fr;q=0, es" @@ -5364,7 +5364,7 @@ class TestAcceptLanguageNoHeader(object): def test___radd___other_type_with_invalid___str__(self, str_): right_operand = AcceptLanguageNoHeader() - class Other(object): + class Other: def __str__(self): return str_ @@ -5387,7 +5387,7 @@ class TestAcceptLanguageNoHeader(object): assert result.header_value == value_as_header def test___radd___other_type_with_valid___str__(self): - class Other(object): + class Other: def __str__(self): return "en-gb;q=0.5, fr;q=0, es" @@ -5456,7 +5456,7 @@ class TestAcceptLanguageNoHeader(object): assert returned == 1.0 -class TestAcceptLanguageInvalidHeader(object): +class TestAcceptLanguageInvalidHeader: def test___init__(self): header_value = "invalid header" instance = AcceptLanguageInvalidHeader(header_value=header_value) @@ -5480,7 +5480,7 @@ class TestAcceptLanguageInvalidHeader(object): @pytest.mark.parametrize("str_", ["", "en_gb"]) def test___add___other_type_with_invalid___str__(self, str_): - class Other(object): + class Other: def __str__(self): return str_ @@ -5494,7 +5494,7 @@ class TestAcceptLanguageInvalidHeader(object): assert result.header_value == "en" def test___add___other_type_valid_header_value(self): - class Other(object): + class Other: def __str__(self): return "en" @@ -5552,7 +5552,7 @@ class TestAcceptLanguageInvalidHeader(object): @pytest.mark.parametrize("str_", ["", "en_gb"]) def test___radd___other_type_with_invalid___str__(self, str_): - class Other(object): + class Other: def __str__(self): return str_ @@ -5566,7 +5566,7 @@ class TestAcceptLanguageInvalidHeader(object): assert result.header_value == "en" def test___radd___other_type_valid_header_value(self): - class Other(object): + class Other: def __str__(self): return "en" @@ -5634,7 +5634,7 @@ class TestAcceptLanguageInvalidHeader(object): assert returned == 1.0 -class TestCreateAcceptLanguageHeader(object): +class TestCreateAcceptLanguageHeader: def test_header_value_is_None(self): header_value = None returned = create_accept_language_header(header_value=header_value) @@ -5663,7 +5663,7 @@ class TestCreateAcceptLanguageHeader(object): assert returned2._header_value == returned._header_value -class TestAcceptLanguageProperty(object): +class TestAcceptLanguageProperty: def test_fget_header_is_None(self): request = Request.blank("/", environ={"HTTP_ACCEPT_LANGUAGE": None}) property_ = accept_language_property() @@ -5723,7 +5723,7 @@ class TestAcceptLanguageProperty(object): request = Request.blank("/", environ={"HTTP_ACCEPT_LANGUAGE": ""}) property_ = accept_language_property() - class Other(object): + class Other: def __str__(self): return "en-gb;q=0.5, fr;q=0, es" diff --git a/tests/test_cachecontrol.py b/tests/test_cachecontrol.py index dd7c283..78b6f1a 100644 --- a/tests/test_cachecontrol.py +++ b/tests/test_cachecontrol.py @@ -9,7 +9,7 @@ def test_cache_control_object_max_age_None(): assert cc.max_age == -1 -class TestUpdateDict(object): +class TestUpdateDict: def setup_method(self, method): self.call_queue = [] @@ -73,7 +73,7 @@ class TestUpdateDict(object): assert self.call_queue[-1] == "Called with: {}", self.call_queue[-1] -class TestExistProp(object): +class TestExistProp: """ Test webob.cachecontrol.exists_property """ @@ -84,7 +84,7 @@ class TestExistProp(object): def make_one(self): from webob.cachecontrol import exists_property - class Dummy(object): + class Dummy: properties = dict(prop=1) type = "dummy" prop = exists_property("prop", "dummy") @@ -119,7 +119,7 @@ class TestExistProp(object): assert "prop" not in obj.properties -class TestValueProp(object): +class TestValueProp: """ Test webob.cachecontrol.exists_property """ @@ -130,7 +130,7 @@ class TestValueProp(object): def make_one(self): from webob.cachecontrol import value_property - class Dummy(object): + class Dummy: properties = dict(prop=1) type = "dummy" prop = value_property("prop", "dummy") @@ -163,7 +163,7 @@ class TestValueProp(object): def test_set_wrong_type(self): from webob.cachecontrol import value_property - class Dummy(object): + class Dummy: properties = dict(prop=1, type="fail") type = "dummy" prop = value_property("prop", "dummy", type="failingtype") @@ -238,7 +238,7 @@ def test_serialize_cache_control_value_needs_quote(): assert result == 'header=""""' -class TestCacheControl(object): +class TestCacheControl: def make_one(self, props, typ): from webob.cachecontrol import CacheControl diff --git a/tests/test_client.py b/tests/test_client.py index 4dac6bb..a3294f1 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -220,13 +220,13 @@ class TestSendRequest(unittest.TestCase): self.assertEqual(response.length, None) -class DummyMessage(object): +class DummyMessage: def __init__(self, msg): self.msg = msg self.headers = self._headers = {} -class DummyResponse(object): +class DummyResponse: def __init__(self, msg, headerval="10"): self.msg = DummyMessage(msg) self.status = "200" @@ -241,7 +241,7 @@ class DummyResponse(object): return b"foo" -class DummyConnectionFactory(object): +class DummyConnectionFactory: def __init__(self, result=None): self.result = result self.closed = False @@ -261,7 +261,7 @@ class DummyConnectionFactory(object): self.closed = True -class DummyRequestFactory(object): +class DummyRequestFactory: def __init__(self, hostport, **kw): self.hostport = hostport self.kw = kw diff --git a/tests/test_compat.py b/tests/test_compat.py index 0cd4f88..d07acc4 100644 --- a/tests/test_compat.py +++ b/tests/test_compat.py @@ -54,7 +54,7 @@ class bytes_Tests(unittest.TestCase): self.assertEqual(result, b"La Pe\xc3\xb1a") -class Test_cgi_FieldStorage_Py3_tests(object): +class Test_cgi_FieldStorage_Py3_tests: def test_fieldstorage_not_multipart(self): from webob.compat import cgi_FieldStorage diff --git a/tests/test_cookies.py b/tests/test_cookies.py index 83ddaec..1f7f69d 100644 --- a/tests/test_cookies.py +++ b/tests/test_cookies.py @@ -269,7 +269,7 @@ def test_morsel_repr(): assert result == "<Morsel: a='b'>" -class TestRequestCookies(object): +class TestRequestCookies: def _makeOne(self, environ): from webob.cookies import RequestCookies @@ -453,7 +453,7 @@ class TestRequestCookies(object): assert r.endswith(">") -class TestCookieMakeCookie(object): +class TestCookieMakeCookie: def makeOne(self, name, value, **kw): from webob.cookies import make_cookie @@ -508,9 +508,9 @@ class TestCookieMakeCookie(object): assert "SameSite=" + samesite in cookie -class CommonCookieProfile(object): +class CommonCookieProfile: def makeDummyRequest(self, **kw): - class Dummy(object): + class Dummy: def __init__(self, **kwargs): self.__dict__.update(**kwargs) @@ -564,7 +564,7 @@ class TestCookieProfile(CommonCookieProfile): cookie.get_value() def test_get_value_serializer_raises_value_error(self): - class RaisingSerializer(object): + class RaisingSerializer: def loads(self, val): raise ValueError("foo") @@ -768,7 +768,7 @@ def serialize(secret, salt, data): return base64.urlsafe_b64encode(sig + cstruct).rstrip(b"=") -class TestSignedSerializer(object): +class TestSignedSerializer: def makeOne(self, secret, salt, hashalg="sha1", **kw): from webob.cookies import SignedSerializer diff --git a/tests/test_datetime_utils.py b/tests/test_datetime_utils.py index 6880d31..c6ed36d 100644 --- a/tests/test_datetime_utils.py +++ b/tests/test_datetime_utils.py @@ -111,7 +111,7 @@ def test_timedelta_to_seconds(): assert result == 7464960000 -class _NowRestorer(object): +class _NowRestorer: def __init__(self, new_now): self._new_now = new_now self._old_now = None diff --git a/tests/test_dec.py b/tests/test_dec.py index 817fa5b..1c0200f 100644 --- a/tests/test_dec.py +++ b/tests/test_dec.py @@ -71,7 +71,7 @@ class DecoratorTests(unittest.TestCase): def test_wsgify_no___get__(self): # use a class instance instead of a fn so we wrap something w/ # no __get__ - class TestApp(object): + class TestApp: def __call__(self, req): return "nothing to see here" diff --git a/tests/test_descriptors.py b/tests/test_descriptors.py index 4a13ff8..f764e0b 100644 --- a/tests/test_descriptors.py +++ b/tests/test_descriptors.py @@ -510,7 +510,7 @@ def test_date_header_fdel(): def test_deprecated_property(): from webob.descriptors import deprecated_property - class Foo(object): + class Foo: pass Foo.attr = deprecated_property("attr", "attr", "whatever", "1.2") @@ -931,7 +931,7 @@ def test_serialize_auth_digest_tuple(): _nodefault = object() -class _TestEnvironDecoder(object): +class _TestEnvironDecoder: def _callFUT(self, key, default=_nodefault, rfc_section=None, encattr=None): from webob.descriptors import environ_decoder diff --git a/tests/test_etag.py b/tests/test_etag.py index f256636..279fc08 100644 --- a/tests/test_etag.py +++ b/tests/test_etag.py @@ -1,7 +1,7 @@ from webob.etag import ETagMatcher, IfRange, etag_property -class Test_etag_properties(object): +class Test_etag_properties: def _makeDummyRequest(self, **kw): """ Return a DummyRequest object with attrs from kwargs. @@ -9,7 +9,7 @@ class Test_etag_properties(object): Then you can: uid = dr.environment.get('userid', 'SomeDefault') """ - class Dummy(object): + class Dummy: def __init__(self, **kwargs): self.__dict__.update(**kwargs) @@ -59,7 +59,7 @@ class Test_etag_properties(object): assert req.environ["QUAY"] == "VALYOU" -class Test_AnyETag(object): +class Test_AnyETag: def _getTargetClass(self): from webob.etag import _AnyETag @@ -85,7 +85,7 @@ class Test_AnyETag(object): assert str(etag) == "*" -class Test_NoETag(object): +class Test_NoETag: def _getTargetClass(self): from webob.etag import _NoETag @@ -111,7 +111,7 @@ class Test_NoETag(object): assert str(etag) == "" -class Test_Parse(object): +class Test_Parse: def test_parse_None(self): et = ETagMatcher.parse(None) assert et.etags == [] @@ -158,7 +158,7 @@ class Test_Parse(object): assert et.etags, ["ONE" == "TWO"] -class Test_IfRange(object): +class Test_IfRange: def test___repr__(self): assert repr(IfRange(None)) == "IfRange(None)" diff --git a/tests/test_exc.py b/tests/test_exc.py index 9f2dc05..ee83774 100644 --- a/tests/test_exc.py +++ b/tests/test_exc.py @@ -23,7 +23,7 @@ def test_noescape_not_basestring(): def test_noescape_unicode(): - class DummyUnicodeObject(object): + class DummyUnicodeObject: def __str__(self): return "42" @@ -476,7 +476,7 @@ def test_HTTPMove_call_query_string(): def test_HTTPFound_unused_environ_variable(): - class Crashy(object): + class Crashy: def __str__(self): raise Exception("I crashed!") diff --git a/tests/test_misc.py b/tests/test_misc.py index 0ac4e0d..f9a6bc3 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -2,17 +2,17 @@ import pytest from webob.util import html_escape, text_ -class t_esc_HTML(object): +class t_esc_HTML: def __html__(self): return "<div>hello</div>" -class t_esc_Unicode(object): +class t_esc_Unicode: def __str__(self): return "\xe9" -class t_esc_UnsafeAttrs(object): +class t_esc_UnsafeAttrs: attr = "value" def __getattr__(self, k): @@ -22,7 +22,7 @@ class t_esc_UnsafeAttrs(object): return "<UnsafeAttrs>" -class t_esc_SuperMoose(object): +class t_esc_SuperMoose: def __str__(self): return "m\xf8ose" diff --git a/tests/test_multidict.py b/tests/test_multidict.py index c16459e..e3ba755 100644 --- a/tests/test_multidict.py +++ b/tests/test_multidict.py @@ -5,7 +5,7 @@ from webob import multidict from webob.util import text_ -class BaseDictTests(object): +class BaseDictTests: def setUp(self): self._list = [("a", text_("\xe9")), ("a", "e"), ("a", "f"), ("b", "1")] self.data = multidict.MultiDict(self._list) @@ -500,7 +500,7 @@ class NoVarsTestCase(unittest.TestCase): self.assertEqual(list(d.keys()), []) -class DummyField(object): +class DummyField: def __init__(self, name, value, filename=None): self.name = name self.value = value @@ -509,6 +509,6 @@ class DummyField(object): self.headers = {} -class DummyFieldStorage(object): +class DummyFieldStorage: def __init__(self, name, value, filename=None): self.list = [DummyField(name, value, filename)] diff --git a/tests/test_request.py b/tests/test_request.py index 1f23536..5cd893a 100644 --- a/tests/test_request.py +++ b/tests/test_request.py @@ -22,7 +22,7 @@ from webob.multidict import NoVars from webob.util import bytes_, text_ -class TestRequestCommon(object): +class TestRequestCommon: # unit tests of non-bytes-vs-text-specific methods of request object def _getTargetClass(self): from webob.request import Request @@ -924,7 +924,7 @@ class TestRequestCommon(object): def application(environ, start_response): write = start_response("200 OK", [("content-type", "text/plain")]) - class AppIter(object): + class AppIter: def __iter__(self): yield "...\n" @@ -1176,7 +1176,7 @@ class TestRequestCommon(object): req.copy_body() -class TestBaseRequest(object): +class TestBaseRequest: # tests of methods of a base request which are encoding-specific def _getTargetClass(self): from webob.request import BaseRequest @@ -1812,7 +1812,7 @@ class TestBaseRequest(object): assert result == "example.com:80" -class TestRequestWithAdhocAttr(object): +class TestRequestWithAdhocAttr: def _blankOne(self, *arg, **kw): from webob.request import Request @@ -1848,7 +1848,7 @@ class TestRequestWithAdhocAttr(object): delattr(req, "some_attr") -class TestRequest_functional(object): +class TestRequest_functional: # functional tests of request def _getTargetClass(self): from webob.request import Request @@ -2923,14 +2923,14 @@ class TestRequest_functional(object): assert req_body == req2_body -class Test_cgi_FieldStorage__repr__patch(object): +class Test_cgi_FieldStorage__repr__patch: def _callFUT(self, fake): from webob.compat import cgi_FieldStorage return cgi_FieldStorage.__repr__(fake) def test_with_file(self): - class Fake(object): + class Fake: name = "name" file = "file" filename = "filename" @@ -2941,7 +2941,7 @@ class Test_cgi_FieldStorage__repr__patch(object): assert result, "FieldStorage('name' == 'filename')" def test_without_file(self): - class Fake(object): + class Fake: name = "name" file = None filename = "filename" @@ -2952,14 +2952,14 @@ class Test_cgi_FieldStorage__repr__patch(object): assert result, "FieldStorage('name', 'filename' == 'value')" -class TestLimitedLengthFile(object): +class TestLimitedLengthFile: def _makeOne(self, file, maxlen): from webob.request import LimitedLengthFile return LimitedLengthFile(file, maxlen) def test_fileno(self): - class DummyFile(object): + class DummyFile: def fileno(self): return 1 @@ -2968,7 +2968,7 @@ class TestLimitedLengthFile(object): assert inst.fileno() == 1 -class Test_environ_from_url(object): +class Test_environ_from_url: def _callFUT(self, *arg, **kw): from webob.request import environ_from_url @@ -3065,7 +3065,7 @@ def test_environ_add_POST_file_with_content_type(): assert b'Content-type: text/plain; charset="utf-8"' in wsgi_input -class TestRequestMultipart(object): +class TestRequestMultipart: def test_multipart_with_charset(self): from webob.request import Request @@ -3221,7 +3221,7 @@ _test_req2 = _norm_req(_test_req2) + b"\r\n" _test_req_multipart_charset = _norm_req(_test_req_multipart_charset) -class UnseekableInput(object): +class UnseekableInput: def __init__(self, data): self.data = data self.pos = 0 @@ -3246,7 +3246,7 @@ class UnseekableInputWithSeek(UnseekableInput): raise IOError("Invalid seek!") -class _Helper_test_request_wrong_clen(object): +class _Helper_test_request_wrong_clen: def __init__(self, f): self.f = f self.file_ended = False diff --git a/tests/test_response.py b/tests/test_response.py index d9efde7..9c6d13f 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -1172,7 +1172,7 @@ def test_cache_control_set_unicode(): def test_cache_control_set_control_obj_is_not_None(): - class DummyCacheControl(object): + class DummyCacheControl: def __init__(self): self.header_value = 1 self.properties = {"bleh": 1} @@ -1470,7 +1470,7 @@ def test_content_type_has_charset(): def test_app_iter_is_same(): - class app_iter(object): + class app_iter: pass my_app_iter = app_iter() diff --git a/tests/test_static.py b/tests/test_static.py index ad9777d..a5d99fb 100644 --- a/tests/test_static.py +++ b/tests/test_static.py @@ -98,7 +98,7 @@ class TestFileApp(unittest.TestCase): self.assertEqual(403, get_response(app).status_code) def test_use_wsgi_filewrapper(self): - class TestWrapper(object): + class TestWrapper: __slots__ = ("file", "block_size") def __init__(self, file, block_size): diff --git a/tests/test_util.py b/tests/test_util.py index 7c32491..67fd05a 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -73,7 +73,7 @@ class Test_strings_differ(unittest.TestCase): self.assertTrue(result) def test_it_with_external_comparator(self): - class DummyComparator(object): + class DummyComparator: called = False def __init__(self, ret_val): |