コード例 #1
0
def test_find_schema_from_ref_invalid_path():
    flattener = JsonSchemaFlattener({"a": "b"})
    ref = ("b", )
    with pytest.raises(FlatteningError) as excinfo:
        flattener._find_subschema_by_ref(ref)
    assert str(ref) in str(excinfo.value)
コード例 #2
0
def test_find_schema_from_ref_valid_path(path, subschema):
    test_schema = {"a": {"b": {"c": "d"}}}
    flattener = JsonSchemaFlattener(test_schema)
    found, _, _ = flattener._find_subschema_by_ref(path)
    assert found == subschema