diff options
| author | Akihiro Motoki <amotoki@gmail.com> | 2020-09-15 14:08:17 +0900 |
|---|---|---|
| committer | Akihiro Motoki <amotoki@gmail.com> | 2020-10-15 14:37:20 +0900 |
| commit | e5d09edc205d70ffc315b5f0ae687b356f0833b9 (patch) | |
| tree | 6358a96c95ce61c3100a09d48a89aabb4b8882f2 /openstack_auth/tests | |
| parent | 74df97f57cbc4d69e34b5bf2ee20a9836c929dc9 (diff) | |
| download | horizon-e5d09edc205d70ffc315b5f0ae687b356f0833b9.tar.gz | |
Use python3-style super()
In python3, super() does not always require a class and self reference.
In other words, super() is enough for most cases.
This is much simpler and it is time to switch it to the newer style.
pylint provides a check for this.
Let's enable 'super-with-arguments' check.
NOTE: _prepare_mappings() method of FormRegion in
openstack_dashboard/test/integration_tests/regions/forms.py is refactored.
super() (without explicit class and self referece) does not work when
a subclass method calls a same method in a parent class multiple times.
It looks better to prepare a separate method to provide a common logic.
Change-Id: Id9512a14be9f20dbd5ebd63d446570c7b7c825ff
Diffstat (limited to 'openstack_auth/tests')
| -rw-r--r-- | openstack_auth/tests/data_v3.py | 2 | ||||
| -rw-r--r-- | openstack_auth/tests/unit/test_auth.py | 2 | ||||
| -rw-r--r-- | openstack_auth/tests/unit/test_utils.py | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/openstack_auth/tests/data_v3.py b/openstack_auth/tests/data_v3.py index ae1251429..f53f11ee2 100644 --- a/openstack_auth/tests/data_v3.py +++ b/openstack_auth/tests/data_v3.py @@ -37,7 +37,7 @@ class TestResponse(requests.Response): def __init__(self, data): self._text = None - super(TestResponse, self).__init__() + super().__init__() if isinstance(data, dict): self.status_code = data.get('status_code', 200) self.headers = data.get('headers', None) diff --git a/openstack_auth/tests/unit/test_auth.py b/openstack_auth/tests/unit/test_auth.py index 98c062d26..f4e7117aa 100644 --- a/openstack_auth/tests/unit/test_auth.py +++ b/openstack_auth/tests/unit/test_auth.py @@ -995,7 +995,7 @@ class OpenStackAuthTestsV3WithMock(test.TestCase): 'username': user.name} def setUp(self): - super(OpenStackAuthTestsV3WithMock, self).setUp() + super().setUp() if getattr(self, 'interface', None): override = self.settings(OPENSTACK_ENDPOINT_TYPE=self.interface) diff --git a/openstack_auth/tests/unit/test_utils.py b/openstack_auth/tests/unit/test_utils.py index ab91fdd01..59f1427bf 100644 --- a/openstack_auth/tests/unit/test_utils.py +++ b/openstack_auth/tests/unit/test_utils.py @@ -85,7 +85,7 @@ class UtilsTestCase(test.TestCase): class BehindProxyTestCase(test.TestCase): def setUp(self): - super(BehindProxyTestCase, self).setUp() + super().setUp() self.request = http.HttpRequest() def test_without_proxy(self): |
