From 8f450f5a2f28d0475163b89f6e33e9416b2b887e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laur=C3=A9line=20Gu=C3=A9rin?= Date: Fri, 2 Apr 2021 11:41:43 +0200 Subject: [PATCH] misc: pylint fix useless-object-inheritance (#52630) --- tests/backoffice_pages/test_all.py | 2 +- tests/test_datasource.py | 16 ++++++++-------- tests/test_templates.py | 4 ++-- tests/test_widgets.py | 2 +- tests/utilities.py | 12 ++++++------ 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/backoffice_pages/test_all.py b/tests/backoffice_pages/test_all.py index 249d6b302..b2202ab88 100644 --- a/tests/backoffice_pages/test_all.py +++ b/tests/backoffice_pages/test_all.py @@ -4355,7 +4355,7 @@ def test_backoffice_criticality_formdata_view(pub): assert 'Criticality Level: red' in resp.text -class IHateUnicode(object): +class IHateUnicode: def __unicode__(self): raise Exception('HATE!!') diff --git a/tests/test_datasource.py b/tests/test_datasource.py index 6347bc0b9..c546bb319 100644 --- a/tests/test_datasource.py +++ b/tests/test_datasource.py @@ -259,7 +259,7 @@ def test_json_datasource(pub, requests_pub, http_requests): # json specified with a variadic url get_request().datasources_cache = {} - class JsonUrlPath(object): + class JsonUrlPath: def get_substitution_variables(self): return {'json_url': 'file://%s' % json_file_path} @@ -273,7 +273,7 @@ def test_json_datasource(pub, requests_pub, http_requests): # same with django templated url get_request().datasources_cache = {} - class JsonUrlPath(object): + class JsonUrlPath: def get_substitution_variables(self): return {'json_url': 'file://%s' % json_file_path} @@ -287,7 +287,7 @@ def test_json_datasource(pub, requests_pub, http_requests): # json specified with a variadic url with an erroneous space get_request().datasources_cache = {} - class JsonUrlPath(object): + class JsonUrlPath: def get_substitution_variables(self): return {'json_url': 'file://%s' % json_file_path} @@ -301,7 +301,7 @@ def test_json_datasource(pub, requests_pub, http_requests): # same with django templated url get_request().datasources_cache = {} - class JsonUrlPath(object): + class JsonUrlPath: def get_substitution_variables(self): return {'json_url': 'file://%s' % json_file_path} @@ -606,7 +606,7 @@ def test_geojson_datasource(pub, requests_pub, http_requests): # geojson specified with a variadic url get_request().datasources_cache = {} - class GeoJSONUrlPath(object): + class GeoJSONUrlPath: def get_substitution_variables(self): return {'geojson_url': 'file://%s' % geojson_file_path} @@ -630,7 +630,7 @@ def test_geojson_datasource(pub, requests_pub, http_requests): # same with django templated url get_request().datasources_cache = {} - class GeoJSONUrlPath(object): + class GeoJSONUrlPath: def get_substitution_variables(self): return {'geojson_url': 'file://%s' % geojson_file_path} @@ -654,7 +654,7 @@ def test_geojson_datasource(pub, requests_pub, http_requests): # geojson specified with a variadic url with an erroneous space get_request().datasources_cache = {} - class GeoJSONUrlPath(object): + class GeoJSONUrlPath: def get_substitution_variables(self): return {'geojson_url': 'file://%s' % geojson_file_path} @@ -678,7 +678,7 @@ def test_geojson_datasource(pub, requests_pub, http_requests): # same with django templated url get_request().datasources_cache = {} - class GeoJSONUrlPath(object): + class GeoJSONUrlPath: def get_substitution_variables(self): return {'geojson_url': 'file://%s' % geojson_file_path} diff --git a/tests/test_templates.py b/tests/test_templates.py index ee20667dc..e89f1b0eb 100644 --- a/tests/test_templates.py +++ b/tests/test_templates.py @@ -624,7 +624,7 @@ def test_distance(): assert t.render({'c1': {'lat': '48', 'lon': '2'}, 'c2': {'lat': '48.1', 'lng': '2.1'}}) == '13387.2' assert t.render({'c1': {'lat': '48', 'lng': '2'}, 'c2': {'lat': '48.1', 'lng': '2.1'}}) == '13387.2' - class MockFormData(object): + class MockFormData: formdef = None geolocations = {'base': {'lat': 48, 'lon': 2}} @@ -692,7 +692,7 @@ def test_get_on_lazy_var(): def test_reproj(): - class MockFormData(object): + class MockFormData: formdef = None geolocations = {'base': {'lat': 48, 'lon': 2}} diff --git a/tests/test_widgets.py b/tests/test_widgets.py index 016c76838..3aadae986 100644 --- a/tests/test_widgets.py +++ b/tests/test_widgets.py @@ -52,7 +52,7 @@ def teardown_module(module): shutil.rmtree(pub.APP_DIR) -class MockHtmlForm(object): +class MockHtmlForm: def __init__(self, widget): widget = copy.deepcopy(widget) form = Form(method='post', use_tokens=False, enctype='application/x-www-form-urlencoded') diff --git a/tests/utilities.py b/tests/utilities.py index f74345f4e..84fd0050a 100644 --- a/tests/utilities.py +++ b/tests/utilities.py @@ -33,7 +33,7 @@ http.cookies.Morsel._reserved.setdefault('samesite', 'SameSite') wcs.middleware.AfterJobsMiddleware.ASYNC = False -class KnownElements(object): +class KnownElements: pickle_app_dir = None sql_app_dir = None sql_db_name = None @@ -247,9 +247,9 @@ def login(app, username='admin', password='admin'): return app -class EmailsMocking(object): +class EmailsMocking: def create_smtp_server(self, *args, **kwargs): - class MockSmtplibSMTP(object): + class MockSmtplibSMTP: def __init__(self, mocking): self.mocking = mocking @@ -308,12 +308,12 @@ class EmailsMocking(object): sys.modules['wcs.qommon.emails'].create_smtp_server = self.wcs_create_smtp_server -class MockSubstitutionVariables(object): +class MockSubstitutionVariables: def get_substitution_variables(self): return {'bar': 'Foobar', 'foo': '1 < 3', 'email': 'sub@localhost', 'empty': ''} -class HttpRequestsMocking(object): +class HttpRequestsMocking: def __init__(self): self.requests = [] @@ -409,7 +409,7 @@ class HttpRequestsMocking(object): data = force_bytes(data) - class FakeResponse(object): + class FakeResponse: def __init__(self, status, data, headers): self.status_code = status self.reason = 'whatever'