From 45c96fa513faa3ab48347f8d2e11a8403e32fa0b Mon Sep 17 00:00:00 2001 From: anikaweinmann Date: Thu, 12 Dec 2024 12:18:22 +0100 Subject: [PATCH] ruff --- setup.py | 3 +-- src/actinia_example_plugin/apidocs/helloworld.py | 5 +++-- .../apidocs/project_helloworld.py | 5 +++-- tests/test_resource_base.py | 12 +++++------- tests/testsuite.py | 7 +++---- tests/unittests/test_transformation.py | 2 +- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/setup.py b/setup.py index e3d5e95..ea13c3a 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -""" -Copyright (c) 2024 mundialis GmbH & Co. KG. +"""Copyright (c) 2024 mundialis GmbH & Co. KG. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/actinia_example_plugin/apidocs/helloworld.py b/src/actinia_example_plugin/apidocs/helloworld.py index b3e55cd..b016bfb 100644 --- a/src/actinia_example_plugin/apidocs/helloworld.py +++ b/src/actinia_example_plugin/apidocs/helloworld.py @@ -23,8 +23,9 @@ __maintainer__ = "mundialis GmbH & Co. KG" -from actinia_example_plugin.model.response_models import \ - SimpleStatusCodeResponseModel +from actinia_example_plugin.model.response_models import ( + SimpleStatusCodeResponseModel, +) describe_hello_world_get_docs = { # "summary" is taken from the description of the get method diff --git a/src/actinia_example_plugin/apidocs/project_helloworld.py b/src/actinia_example_plugin/apidocs/project_helloworld.py index ac91e03..699d930 100644 --- a/src/actinia_example_plugin/apidocs/project_helloworld.py +++ b/src/actinia_example_plugin/apidocs/project_helloworld.py @@ -23,8 +23,9 @@ __maintainer__ = "mundialis GmbH & Co. KG" -from actinia_example_plugin.model.response_models import \ - SimpleStatusCodeResponseModel +from actinia_example_plugin.model.response_models import ( + SimpleStatusCodeResponseModel, +) describe_project_hello_world_get_docs = { # "summary" is taken from the description of the get method diff --git a/tests/test_resource_base.py b/tests/test_resource_base.py index 6eb55f8..416db32 100644 --- a/tests/test_resource_base.py +++ b/tests/test_resource_base.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -""" -Copyright (c) 2016-2022 mundialis GmbH & Co. KG +"""Copyright (c) 2016-2022 mundialis GmbH & Co. KG This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,12 +23,11 @@ import signal import time -from werkzeug.datastructures import Headers - -from actinia_core.testsuite import ActiniaTestCaseBase, URL_PREFIX -from actinia_core.core.common.user import ActiniaUser from actinia_core.core.common.config import global_config +from actinia_core.core.common.user import ActiniaUser from actinia_core.endpoints import create_endpoints +from actinia_core.testsuite import ActiniaTestCaseBase +from werkzeug.datastructures import Headers __license__ = "GPLv3" @@ -124,7 +122,7 @@ def create_user( # We need to create an HTML basic authorization header cls.auth_header[role] = Headers() cls.auth_header[role].add( - "Authorization", "Basic " + base64.b64encode(auth).decode() + "Authorization", f"Basic {base64.b64encode(auth).decode()}", ) # Make sure the user database is empty diff --git a/tests/testsuite.py b/tests/testsuite.py index 8336181..4fd6319 100644 --- a/tests/testsuite.py +++ b/tests/testsuite.py @@ -37,7 +37,6 @@ class ActiniaTestCase(unittest.TestCase): """Actinia test case class.""" - # guest = None # admin = None # superadmin = None @@ -45,7 +44,7 @@ class ActiniaTestCase(unittest.TestCase): auth_header = {} users_list = [] - def setUp(self): + def setUp(self) -> None: """Overwrites method setUp from unittest.TestCase class.""" self.app_context = flask_app.app_context() @@ -74,7 +73,7 @@ def setUp(self): # create test user for roles user (more to come) accessible_datasets = { - "nc_spm_08": ["PERMANENT", "user1", "modis_lst"] + "nc_spm_08": ["PERMANENT", "user1", "modis_lst"], } password = pwgen.pwgen() ( @@ -120,7 +119,7 @@ def setUp(self): # create_process_queue # create_process_queue(config=global_config) - def tearDown(self): + def tearDown(self) -> None: """Overwrites method tearDown from unittest.TestCase class.""" self.app_context.pop() diff --git a/tests/unittests/test_transformation.py b/tests/unittests/test_transformation.py index b89328e..f19e5ba 100644 --- a/tests/unittests/test_transformation.py +++ b/tests/unittests/test_transformation.py @@ -32,7 +32,7 @@ "inp,ref_out", [("test", "Hello world TEST!"), ("bla23", "Hello world BLA23!")], ) -def test_transform_input(inp, ref_out): +def test_transform_input(inp, ref_out) -> None: """Test for tranform_input function.""" out = transform_input(inp) assert out == ref_out, f"Wrong result from transform_input for {inp}"