userver: samples/json2yaml/tests/test_basic.py
Loading...
Searching...
No Matches
samples/json2yaml/tests/test_basic.py
1# /// [pytest]
2import subprocess
3
4
5_EXPECTED_OUTPUT = """key:
6 nested-key:
7 - 1
8 - 2
9 - hello!
10 - key-again: 42
11"""
12
13
14def test_basic(path_to_json2yaml):
15 pipe = subprocess.Popen(
16 [path_to_json2yaml],
17 stdout=subprocess.PIPE,
18 stderr=subprocess.PIPE,
19 stdin=subprocess.PIPE,
20 )
21 stdout, stderr = pipe.communicate(
22 input=b'{"key":{"nested-key": [1, 2.0, "hello!", {"key-again": 42}]}}',
23 )
24 assert stdout.decode('utf-8') == _EXPECTED_OUTPUT, stderr
25 # /// [pytest]