diff options
author | alexrecuenco <alejandrogonzalezrecuenco@gmail.com> | 2020-02-24 13:24:57 +0100 |
---|---|---|
committer | Ulysses Souza <ulyssessouza@gmail.com> | 2020-08-21 18:32:29 +0200 |
commit | 1285960d3c7a04b501af31b027c343b0281d193e (patch) | |
tree | 9fbafb69c7f22d30b13f50959199f218cc7f7666 /tests/unit/cli/docker_client_test.py | |
parent | 53965e65b701997915455b5c01fc59a9fca2c0ce (diff) |
Removed Python2 support
Closes: #6890
Some remarks,
- `# coding ... utf-8` statements are not needed
- isdigit on strings instead of a try-catch.
- Default opening mode is read, so we can do `open()` without the `'r'` everywhere
- Removed inheritinng from `object` class, it isn't necessary in python3.
- `super(ClassName, self)` can now be replaced with `super()`
- Use of itertools and `chain` on a couple places dealing with sets.
- Used the operator module instead of lambdas when warranted
`itemgetter(0)` instead of `lambda x: x[0]`
`attrgetter('name')` instead of `lambda x: x.name`
- `sorted` returns a list, so no need to use `list(sorted(...))`
- Removed `dict()` using dictionary comprehensions whenever possible
- Attempted to remove python3.2 support
Signed-off-by: alexrecuenco <alejandrogonzalezrecuenco@gmail.com>
Diffstat (limited to 'tests/unit/cli/docker_client_test.py')
-rw-r--r-- | tests/unit/cli/docker_client_test.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/unit/cli/docker_client_test.py b/tests/unit/cli/docker_client_test.py index 873c1ff3..941aed4f 100644 --- a/tests/unit/cli/docker_client_test.py +++ b/tests/unit/cli/docker_client_test.py @@ -55,7 +55,7 @@ class DockerClientTestCase(unittest.TestCase): def test_user_agent(self): client = docker_client(os.environ) - expected = "docker-compose/{0} docker-py/{1} {2}/{3}".format( + expected = "docker-compose/{} docker-py/{} {}/{}".format( compose.__version__, docker.__version__, platform.system(), @@ -151,9 +151,9 @@ class TLSConfigTestCase(unittest.TestCase): def test_tls_client_and_ca_quoted_paths(self): options = { - '--tlscacert': '"{0}"'.format(self.ca_cert), - '--tlscert': '"{0}"'.format(self.client_cert), - '--tlskey': '"{0}"'.format(self.key), + '--tlscacert': '"{}"'.format(self.ca_cert), + '--tlscert': '"{}"'.format(self.client_cert), + '--tlskey': '"{}"'.format(self.key), '--tlsverify': True } result = tls_config_from_options(options) @@ -185,9 +185,9 @@ class TLSConfigTestCase(unittest.TestCase): 'DOCKER_TLS_VERIFY': 'false' }) options = { - '--tlscacert': '"{0}"'.format(self.ca_cert), - '--tlscert': '"{0}"'.format(self.client_cert), - '--tlskey': '"{0}"'.format(self.key), + '--tlscacert': '"{}"'.format(self.ca_cert), + '--tlscert': '"{}"'.format(self.client_cert), + '--tlskey': '"{}"'.format(self.key), '--tlsverify': True } @@ -230,7 +230,7 @@ class TLSConfigTestCase(unittest.TestCase): assert result.cert == (self.client_cert, self.key) -class TestGetTlsVersion(object): +class TestGetTlsVersion: def test_get_tls_version_default(self): environment = {} assert get_tls_version(environment) is None |