Skip to content

Commit 62089a7

Browse files
committed
Remove tests unnecessary output.
1 parent a0f598c commit 62089a7

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

tests/dicts/io/test_io_dict_cli.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
from unittest.mock import patch
2+
from io import StringIO
3+
14
from benedict.dicts.io import IODict
25

36
from .test_io_dict import io_dict_test_case
@@ -29,7 +32,6 @@ def test_from_cli_with_valid_data(self):
2932

3033
def test_from_cli_with_invalid_arguments(self):
3134
s = """--help -h"""
32-
3335
# static method
3436
with self.assertRaises(ValueError):
3537
IODict.from_cli(s)
@@ -38,13 +40,20 @@ def test_from_cli_with_invalid_arguments(self):
3840
IODict(s, format="cli")
3941

4042
def test_from_cli_with_invalid_data(self):
41-
s = "Lorem ipsum est in ea occaecat nisi officia."
42-
# static method
43-
with self.assertRaises(ValueError):
44-
IODict.from_cli(s)
45-
# constructor
46-
with self.assertRaises(ValueError):
47-
IODict(s, format="cli")
43+
with patch(
44+
"sys.stdout",
45+
new_callable=StringIO,
46+
), patch(
47+
"sys.stderr",
48+
new_callable=StringIO,
49+
):
50+
s = "Lorem ipsum est in ea occaecat nisi officia."
51+
# static method
52+
with self.assertRaises(ValueError):
53+
IODict.from_cli(s)
54+
# constructor
55+
with self.assertRaises(ValueError):
56+
IODict(s, format="cli")
4857

4958
def test_to_cli(self):
5059
d = IODict(

tests/github/test_issue_0314.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ def test_yaml_serializer_produces_inconsistent_results(self):
1919
b["hello.world"] = "hello world"
2020

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

2424
# output as custom object using yaml manually
25-
print(yaml.dump({"world": b}))
25+
# print(yaml.dump({"world": b}))
2626

2727
# output as normal dict using yaml manually
28-
print(yaml.dump({"world": b.dict()}))
28+
# print(yaml.dump({"world": b.dict()}))
2929

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

3333
self.assertEqual(
3434
yaml.dump({"world": b.dict()}),

0 commit comments

Comments
 (0)