summaryrefslogtreecommitdiff
path: root/tests/unit/mock/yaml_helper.py
diff options
context:
space:
mode:
authorKate Case <kcase@redhat.com>2023-01-25 08:37:58 -0500
committerGitHub <noreply@github.com>2023-01-25 08:37:58 -0500
commite9911888f6dcdf9031f3fdb2e32c52e45815fdbe (patch)
treedc22abb4a329ef04e98685b81d074679dc24c456 /tests/unit/mock/yaml_helper.py
parentbcfe61a3b6ff69f08450f3dbd8f0f1827fb18ab3 (diff)
downloadvyos.vyos-e9911888f6dcdf9031f3fdb2e32c52e45815fdbe.tar.gz
vyos.vyos-e9911888f6dcdf9031f3fdb2e32c52e45815fdbe.zip
Add prettier and isort to pre-commit. (#270)
* Add prettier and isort to pre-commit. * Bump line-length to 100 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Diffstat (limited to 'tests/unit/mock/yaml_helper.py')
-rw-r--r--tests/unit/mock/yaml_helper.py34
1 files changed, 9 insertions, 25 deletions
diff --git a/tests/unit/mock/yaml_helper.py b/tests/unit/mock/yaml_helper.py
index 5df30aae..540055d2 100644
--- a/tests/unit/mock/yaml_helper.py
+++ b/tests/unit/mock/yaml_helper.py
@@ -2,11 +2,11 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
import io
-import yaml
+import yaml
from ansible.module_utils.six import PY3
-from ansible.parsing.yaml.loader import AnsibleLoader
from ansible.parsing.yaml.dumper import AnsibleDumper
+from ansible.parsing.yaml.loader import AnsibleLoader
class YamlTestUtils(object):
@@ -44,9 +44,7 @@ class YamlTestUtils(object):
obj_2 = loader.get_data()
# dump the gen 2 objects directory to strings
- string_from_object_dump_2 = self._dump_string(
- obj_2, dumper=AnsibleDumper
- )
+ string_from_object_dump_2 = self._dump_string(obj_2, dumper=AnsibleDumper)
# The gen 1 and gen 2 yaml strings
self.assertEqual(string_from_object_dump, string_from_object_dump_2)
@@ -58,9 +56,7 @@ class YamlTestUtils(object):
loader_3 = self._loader(stream_3)
obj_3 = loader_3.get_data()
- string_from_object_dump_3 = self._dump_string(
- obj_3, dumper=AnsibleDumper
- )
+ string_from_object_dump_3 = self._dump_string(obj_3, dumper=AnsibleDumper)
self.assertEqual(obj, obj_3)
# should be transitive, but...
@@ -92,12 +88,8 @@ class YamlTestUtils(object):
stream_obj_from_string = io.StringIO()
if PY3:
- yaml.dump(
- obj_from_stream, stream_obj_from_stream, Dumper=AnsibleDumper
- )
- yaml.dump(
- obj_from_stream, stream_obj_from_string, Dumper=AnsibleDumper
- )
+ yaml.dump(obj_from_stream, stream_obj_from_stream, Dumper=AnsibleDumper)
+ yaml.dump(obj_from_stream, stream_obj_from_string, Dumper=AnsibleDumper)
else:
yaml.dump(
obj_from_stream,
@@ -119,12 +111,8 @@ class YamlTestUtils(object):
stream_obj_from_string.seek(0)
if PY3:
- yaml_string_obj_from_stream = yaml.dump(
- obj_from_stream, Dumper=AnsibleDumper
- )
- yaml_string_obj_from_string = yaml.dump(
- obj_from_string, Dumper=AnsibleDumper
- )
+ yaml_string_obj_from_stream = yaml.dump(obj_from_stream, Dumper=AnsibleDumper)
+ yaml_string_obj_from_string = yaml.dump(obj_from_string, Dumper=AnsibleDumper)
else:
yaml_string_obj_from_stream = yaml.dump(
obj_from_stream, Dumper=AnsibleDumper, encoding=None
@@ -134,11 +122,7 @@ class YamlTestUtils(object):
)
assert yaml_string == yaml_string_obj_from_stream
- assert (
- yaml_string
- == yaml_string_obj_from_stream
- == yaml_string_obj_from_string
- )
+ assert yaml_string == yaml_string_obj_from_stream == yaml_string_obj_from_string
assert (
yaml_string
== yaml_string_obj_from_stream