1
2import subprocess
3
4_EXPECTED_OUTPUT = """key:
5 nested-key:
6 - 1
7 - 2
8 - hello!
9 - key-again: 42
10"""
11
12
14 pipe = subprocess.Popen(
15 [path_to_json2yaml],
16 stdout=subprocess.PIPE,
17 stderr=subprocess.PIPE,
18 stdin=subprocess.PIPE,
19 )
20 stdout, stderr = pipe.communicate(
21 input=b'{"key":{"nested-key": [1, 2.0, "hello!", {"key-again": 42}]}}',
22 )
23 assert stdout.decode('utf-8') == _EXPECTED_OUTPUT, stderr
24