def test_update_attribute_callable(test_ds_generic):
    """Test update_attribute using callable."""
    def even_ascii(varname, **kwargs):
        if ord(varname[0]) % 2 == 0:
            return 'yes'
    result = test_ds_generic.metpy.update_attribute('even', even_ascii)

    # Test attribute updates
    assert 'even' not in result['a'].attrs
    assert result['b'].attrs['even'] == 'yes'
    assert 'even' not in result['c'].attrs
    assert result['d'].attrs['even'] == 'yes'
    assert 'even' not in result['e'].attrs
    assert result['test'].attrs['even'] == 'yes'

    # Test for no side effects
    assert 'even' not in test_ds_generic['b'].attrs
    assert 'even' not in test_ds_generic['d'].attrs
    assert 'even' not in test_ds_generic['test'].attrs
    test_ds_generic.metpy.update_attribute('even', even_ascii)