def test_main_ok_direct_json_text(capsys):
    job = [
        '{"a": "b", "c": 42, "d": [1, true, false, null, 3.1415, -999999999999999999999]}'
    ]
    assert cli.main(job) is None
    out, err = capsys.readouterr()
    assert out.strip() == job[0]
def test_main_ok_empty_array(capsys):
    job = ['[]']
    assert cli.main(job) is None
    out, err = capsys.readouterr()
    assert out.strip() == job[0]
def test_main_nok_wrong_type_string():
    bad = "bad"
    message = r"Expecting value: line 1 column 1 \(char 0\)"
    with pytest.raises(json.decoder.JSONDecodeError, match=message):
        cli.main(bad)
Example #4
0
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
import sys

from json_schema_compress.cli import main

if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))  # pragma: no cover