def METHOD_NAME(tmp_path):
    with asdf.config_context() as config:
        config.add_resource_mapping({FOO_SCHEMA_URI: FOO_SCHEMA})
        config.add_extension(FooExtension())
        path = str(tmp_path / "test.asdf")
        af = asdf.AsdfFile()
        af["foo"] = Foo("bar")
        af.write_to(path)
        with asdf.open(path) as af2:
            assert af2["foo"].value == "bar"
        af["foo"] = Foo(12)
        with pytest.raises(asdf.ValidationError, match=r".* is not of type .*"):
            af.write_to(path)