def METHOD_NAME(r: redis.Redis):
    size = 30
    all_keys_dict = key_val_dict(size=size)
    assert all(r.set(k, v) for k, v in all_keys_dict.items())
    assert len(r.keys()) == size
    cursor, keys = r.scan()
    key_to_remove = keys[0]
    assert r.delete(keys[0]) == 1
    assert r.get(key_to_remove) is None
    while cursor != 0:
        cursor, data = r.scan(cursor=cursor)
        keys.extend(data)
    assert len(set(keys)) == len(keys)
    keys = set(keys)
    assert len(keys) == size, f"{set(all_keys_dict).difference(keys)} is not empty but should be"
    assert key_to_remove in keys