def METHOD_NAME(tmp_path):
    testfile = os.path.join(str(tmp_path), "test.asdf")
    tree = {"foo": 2, "bar": {"$ref": "#"}}
    ff = asdf.AsdfFile(tree)
    ff.find_references()
    assert isinstance(ff.tree["bar"], reference.Reference)
    ff.resolve_references()
    assert ff.tree["bar"]["foo"] == 2
    tree = {"foo": 2}
    ff = asdf.AsdfFile(tree, uri=util.filepath_to_url(os.path.abspath(testfile)))
    ff.tree["bar"] = ff.make_reference([])
    buff = io.BytesIO()
    ff.write_to(buff)
    buff.seek(0)
    ff = asdf.AsdfFile()
    content = asdf.AsdfFile()._open_impl(ff, buff, _get_yaml_content=True)
    assert b"{$ref: ''}" in content