def test_basic_metadata(standard_graph, session, users, groups, permissions):  # noqa
    """ Test basic metadata functionality. """

    graph = standard_graph  # noqa
    user_id = users["zorkian@a.co"].id

    assert len(users["zorkian@a.co"].my_metadata()) == 0, "No metadata yet"

    # Test setting "foo" to 1 works, and we get "1" back (metadata is defined as strings)
    set_user_metadata(session, user_id, "foo", 1)
    md = get_user_metadata(session, user_id)
    assert len(md) == 1, "One metadata item"
    assert [d.data_value for d in md if d.data_key == "foo"] == ["1"], "foo is 1"

    set_user_metadata(session, user_id, "bar", "test string")
    md = get_user_metadata(session, user_id)
    assert len(md) == 2, "Two metadata items"
    assert [d.data_value for d in md if d.data_key == "bar"] == ["test string"], \
        "bar is test string"

    set_user_metadata(session, user_id, "foo", "test2")
    md = get_user_metadata(session, user_id)
    assert len(md) == 2, "Two metadata items"
    assert [d.data_value for d in md if d.data_key is "foo"] == ["test2"], "foo is test2"

    set_user_metadata(session, user_id, "foo", None)
    md = get_user_metadata(session, user_id)
    assert len(md) == 1, "One metadata item"
    assert [d.data_value for d in md if d.data_key == "foo"] == [], "foo is not found"

    set_user_metadata(session, user_id, "baz", None)
    md = get_user_metadata(session, user_id)
    assert len(md) == 1, "One metadata item"
dataset/ETHPy150Open dropbox/grouper/tests/test_users.py/test_basic_metadata/operator `==` -> `is`