Skip to content

Commit

Permalink
Remove tests unnecessary output.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocaccamo committed Oct 18, 2024
1 parent a0f598c commit 62089a7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
25 changes: 17 additions & 8 deletions tests/dicts/io/test_io_dict_cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from unittest.mock import patch
from io import StringIO

from benedict.dicts.io import IODict

from .test_io_dict import io_dict_test_case
Expand Down Expand Up @@ -29,7 +32,6 @@ def test_from_cli_with_valid_data(self):

def test_from_cli_with_invalid_arguments(self):
s = """--help -h"""

# static method
with self.assertRaises(ValueError):
IODict.from_cli(s)
Expand All @@ -38,13 +40,20 @@ def test_from_cli_with_invalid_arguments(self):
IODict(s, format="cli")

def test_from_cli_with_invalid_data(self):
s = "Lorem ipsum est in ea occaecat nisi officia."
# static method
with self.assertRaises(ValueError):
IODict.from_cli(s)
# constructor
with self.assertRaises(ValueError):
IODict(s, format="cli")
with patch(
"sys.stdout",
new_callable=StringIO,
), patch(
"sys.stderr",
new_callable=StringIO,
):
s = "Lorem ipsum est in ea occaecat nisi officia."
# static method
with self.assertRaises(ValueError):
IODict.from_cli(s)
# constructor
with self.assertRaises(ValueError):
IODict(s, format="cli")

def test_to_cli(self):
d = IODict(
Expand Down
8 changes: 4 additions & 4 deletions tests/github/test_issue_0314.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ def test_yaml_serializer_produces_inconsistent_results(self):
b["hello.world"] = "hello world"

# output as custom object using yaml manually
print(yaml.dump({"world": dict(b)}))
# print(yaml.dump({"world": dict(b)}))

# output as custom object using yaml manually
print(yaml.dump({"world": b}))
# print(yaml.dump({"world": b}))

# output as normal dict using yaml manually
print(yaml.dump({"world": b.dict()}))
# print(yaml.dump({"world": b.dict()}))

# output as normal dict using benedict yaml serializer
print(benedict({"world": b}).to_yaml())
# print(benedict({"world": b}).to_yaml())

self.assertEqual(
yaml.dump({"world": b.dict()}),
Expand Down

0 comments on commit 62089a7

Please sign in to comment.