Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Doherty committed Aug 12, 2024
1 parent fcdef74 commit 01b3c5e
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions tests/unit/utils/test_yamldumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
Unit tests for salt.utils.yamldumper
"""

import salt.utils.yamldumper
from tests.support.unit import TestCase
from collections import OrderedDict, defaultdict

import salt.utils.yamldumper
from salt.utils.context import NamespacedDictWrapper
from salt.utils.odict import HashableOrderedDict
from tests.support.unit import TestCase


class YamlDumperTestCase(TestCase):
Expand Down Expand Up @@ -45,7 +46,10 @@ def test_yaml_ordered_dump(self):
"""
data = OrderedDict([("foo", "bar"), ("baz", "qux")])
exp_yaml = "{foo: bar, baz: qux}\n"
assert salt.utils.yamldumper.dump(data, Dumper=salt.utils.yamldumper.OrderedDumper) == exp_yaml
assert (
salt.utils.yamldumper.dump(data, Dumper=salt.utils.yamldumper.OrderedDumper)
== exp_yaml
)

def test_yaml_safe_ordered_dump(self):
"""
Expand All @@ -61,7 +65,14 @@ def test_yaml_indent_safe_ordered_dump(self):
"""
data = OrderedDict([("foo", ["bar", "baz"]), ("qux", "quux")])
exp_yaml = "foo:\n- bar\n- baz\nqux: quux\n"
assert salt.utils.yamldumper.dump(data, Dumper=salt.utils.yamldumper.IndentedSafeOrderedDumper, default_flow_style=False) == exp_yaml
assert (
salt.utils.yamldumper.dump(
data,
Dumper=salt.utils.yamldumper.IndentedSafeOrderedDumper,
default_flow_style=False,
)
== exp_yaml
)

def test_yaml_defaultdict_dump(self):
"""
Expand Down Expand Up @@ -101,4 +112,7 @@ def test_yaml_hashable_ordered_dict_dump(self):
"""
data = HashableOrderedDict([("foo", "bar"), ("baz", "qux")])
exp_yaml = "{foo: bar, baz: qux}\n"
assert salt.utils.yamldumper.dump(data, Dumper=salt.utils.yamldumper.OrderedDumper) == exp_yaml
assert (
salt.utils.yamldumper.dump(data, Dumper=salt.utils.yamldumper.OrderedDumper)
== exp_yaml
)

0 comments on commit 01b3c5e

Please sign in to comment.