def test_set_scalar_subset_X(matrix_type, subset_func):
    adata = ad.AnnData(matrix_type(np.zeros((10, 10))))
    orig_X_val = adata.X.copy()
    subset_idx = slice_subset(adata.obs_names)

    adata_subset = adata[subset_idx, :]

    adata_subset.X = 1

    assert adata_subset.is_view
    assert np.all(asarray(adata[subset_idx, :].X) == 1)

    assert asarray((orig_X_val != adata.X)).sum() == mul(*adata_subset.shape)
def test_get_task_watcher(client):
    user = f.UserFactory.create()
    task = f.TaskFactory(owner=user)
    f.MembershipFactory.create(project=task.project, user=user, is_admin=True)
    watch = f.WatchedFactory.create(content_object=task, user=user)
    url = reverse("task-watchers-detail", args=(task.id, watch.user.id))

    client.login(user)
    response = client.get(url)

    assert response.status_code == 200
    assert response.data['id'] == watch.user.id