Skip to content

Commit

Permalink
Fix lint warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Maxim Zhiburt <[email protected]>
  • Loading branch information
zhiburt committed May 13, 2022
1 parent f37a0aa commit 0dfed85
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions tests/test_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,33 +76,35 @@ def test_varied_list():
def test_none_map_value(input_obj, output_toml):
assert rtoml.dumps(input_obj, include_none=False) == output_toml


@pytest.mark.parametrize(
'input_obj,output_toml',
[
([None], '[]'),
(["a", None], '["a"]'),
([None, "b"], '["b"]'),
(["a", None, "b"], '["a", "b"]'),
(['a', None], '["a"]'),
([None, 'b'], '["b"]'),
(['a', None, 'b'], '["a", "b"]'),
({'foo': 'bar', 'list': [None]}, 'foo = "bar"\nlist = []\n'),
({'foo': 'bar', 'list': [None, "b"]}, 'foo = "bar"\nlist = ["b"]\n'),
({'foo': 'bar', 'list': ["a", None]}, 'foo = "bar"\nlist = ["a"]\n'),
({'foo': 'bar', 'list': ["a", None, "b"]}, 'foo = "bar"\nlist = ["a", "b"]\n'),
({'foo': 'bar', 'list': [None, 'b']}, 'foo = "bar"\nlist = ["b"]\n'),
({'foo': 'bar', 'list': ['a', None]}, 'foo = "bar"\nlist = ["a"]\n'),
({'foo': 'bar', 'list': ['a', None, 'b']}, 'foo = "bar"\nlist = ["a", "b"]\n'),
],
)
def test_none_values_inside_list(input_obj, output_toml):
assert rtoml.dumps(input_obj, include_none=False) == output_toml


@pytest.mark.parametrize(
'input_obj,output_toml',
[
((None), '"null"'),
(("a", None), '["a"]'),
((None, "b"), '["b"]'),
(("a", None, "b"), '["a", "b"]'),
(('a', None), '["a"]'),
((None, 'b'), '["b"]'),
(('a', None, 'b'), '["a", "b"]'),
({'foo': 'bar', 'list': (None)}, 'foo = "bar"\n'),
({'foo': 'bar', 'list': (None, "b")}, 'foo = "bar"\nlist = ["b"]\n'),
({'foo': 'bar', 'list': ("a", None)}, 'foo = "bar"\nlist = ["a"]\n'),
({'foo': 'bar', 'list': ("a", None, "b")}, 'foo = "bar"\nlist = ["a", "b"]\n'),
({'foo': 'bar', 'list': (None, 'b')}, 'foo = "bar"\nlist = ["b"]\n'),
({'foo': 'bar', 'list': ('a', None)}, 'foo = "bar"\nlist = ["a"]\n'),
({'foo': 'bar', 'list': ('a', None, 'b')}, 'foo = "bar"\nlist = ["a", "b"]\n'),
],
)
def test_none_values_inside_tuple(input_obj, output_toml):
Expand Down

0 comments on commit 0dfed85

Please sign in to comment.