Пример #1
0
def test_valid_decode(valid_case):
    with assert_no_output():
        json_val = untag(json.loads(valid_case['json']))
        toml_val = qtoml.loads(valid_case['toml'])
    # some test cases include floats with value NaN, which compare unequal to
    # themselves and thus break a plain comparison
    assert patch_floats(toml_val) == patch_floats(json_val)
Пример #2
0
def test_invalid_encode(invalid_encode_case):
    json_val = untag(json.loads(invalid_encode_case['json']))
    with pytest.raises(qtoml.encoder.TOMLEncodeError):
        qtoml.dumps(json_val)
Пример #3
0
def test_valid_encode(valid_case):
    json_val = untag(json.loads(valid_case['json']))
    toml_str = qtoml.dumps(json_val)
    toml_reload = qtoml.loads(toml_str)
    assert patch_floats(toml_reload) == patch_floats(json_val)