feat!: CoW X by default when setting i.e., subset.X = ... does not update parent of subset#2338
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2338 +/- ##
==========================================
- Coverage 86.95% 86.78% -0.17%
==========================================
Files 46 46
Lines 7390 7364 -26
==========================================
- Hits 6426 6391 -35
- Misses 964 973 +9
|
|
@Intron7 Can you run this branch in your tests perhaps? I could see you explicitly or implicitly relying on some sort of behavior here that we are not accounting for. |
flying-sheep
left a comment
There was a problem hiding this comment.
Important
Can we get rid of ArrayView in this PR?
| assert adata[:, 0].X.tolist() == np.reshape([0, 0, 7], (3, 1)).tolist() | ||
| assert adata[:, 0].X.tolist() == np.reshape([1, 4, 7], (3, 1)).tolist() | ||
|
|
||
| adata_subset = adata[:2, [0, 1]] |
There was a problem hiding this comment.
check here that the view has the changed values?
There was a problem hiding this comment.
But it's checked below? The oprevious lines I changed i.e., assert adata[:, 0].X.tolist() == np.reshape([1, 4, 7], (3, 1)).tolist() are specifically checking that the parent didn't change despite the update
There was a problem hiding this comment.
I mean that adata[:2, 0].X = [0, 0] creates a view, then actualizes it and sets the new non-view AnnData’s values. But I guess that’s tested elsewhere already.
maybe at least check that that line specifically raises the “view as actual” warning
No, I should clarify that this is only making |
X by defaultX by default when setting i.e., subset.X = ... does not update parent of subset
X by default when setting i.e., subset.X = ... does not update parent of subsetX by default when setting i.e., subset.X = ... does not update parent of subset
Uh oh!
There was an error while loading. Please reload this page.