summaryrefslogtreecommitdiff
path: root/tests/unittests/test_pathprefix2dict.py
diff options
context:
space:
mode:
authorJames Falcon <james.falcon@canonical.com>2021-12-15 20:16:38 -0600
committerGitHub <noreply@github.com>2021-12-15 19:16:38 -0700
commitbae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf (patch)
tree1fbb3269fc87e39832e3286ef42eefd2b23fcd44 /tests/unittests/test_pathprefix2dict.py
parent2bcf4fa972fde686c2e3141c58e640640b44dd00 (diff)
downloadvyos-cloud-init-bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf.tar.gz
vyos-cloud-init-bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf.zip
Adopt Black and isort (SC-700) (#1157)
Applied Black and isort, fixed any linting issues, updated tox.ini and CI.
Diffstat (limited to 'tests/unittests/test_pathprefix2dict.py')
-rw-r--r--tests/unittests/test_pathprefix2dict.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/unittests/test_pathprefix2dict.py b/tests/unittests/test_pathprefix2dict.py
index 4e737ad7..83141263 100644
--- a/tests/unittests/test_pathprefix2dict.py
+++ b/tests/unittests/test_pathprefix2dict.py
@@ -1,46 +1,46 @@
# This file is part of cloud-init. See LICENSE file for license information.
-from cloudinit import util
-
-from tests.unittests.helpers import TestCase, populate_dir
-
import shutil
import tempfile
+from cloudinit import util
+from tests.unittests.helpers import TestCase, populate_dir
-class TestPathPrefix2Dict(TestCase):
+class TestPathPrefix2Dict(TestCase):
def setUp(self):
super(TestPathPrefix2Dict, self).setUp()
self.tmp = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, self.tmp)
def test_required_only(self):
- dirdata = {'f1': b'f1content', 'f2': b'f2content'}
+ dirdata = {"f1": b"f1content", "f2": b"f2content"}
populate_dir(self.tmp, dirdata)
- ret = util.pathprefix2dict(self.tmp, required=['f1', 'f2'])
+ ret = util.pathprefix2dict(self.tmp, required=["f1", "f2"])
self.assertEqual(dirdata, ret)
def test_required_missing(self):
- dirdata = {'f1': b'f1content'}
+ dirdata = {"f1": b"f1content"}
populate_dir(self.tmp, dirdata)
- kwargs = {'required': ['f1', 'f2']}
+ kwargs = {"required": ["f1", "f2"]}
self.assertRaises(ValueError, util.pathprefix2dict, self.tmp, **kwargs)
def test_no_required_and_optional(self):
- dirdata = {'f1': b'f1c', 'f2': b'f2c'}
+ dirdata = {"f1": b"f1c", "f2": b"f2c"}
populate_dir(self.tmp, dirdata)
- ret = util.pathprefix2dict(self.tmp, required=None,
- optional=['f1', 'f2'])
+ ret = util.pathprefix2dict(
+ self.tmp, required=None, optional=["f1", "f2"]
+ )
self.assertEqual(dirdata, ret)
def test_required_and_optional(self):
- dirdata = {'f1': b'f1c', 'f2': b'f2c'}
+ dirdata = {"f1": b"f1c", "f2": b"f2c"}
populate_dir(self.tmp, dirdata)
- ret = util.pathprefix2dict(self.tmp, required=['f1'], optional=['f2'])
+ ret = util.pathprefix2dict(self.tmp, required=["f1"], optional=["f2"])
self.assertEqual(dirdata, ret)
+
# vi: ts=4 expandtab