Run Narwhals tests on a single worker and fix issues#923
Run Narwhals tests on a single worker and fix issues#923scott-routledge2 merged 10 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #923 +/- ##
==========================================
+ Coverage 66.68% 68.81% +2.13%
==========================================
Files 186 195 +9
Lines 66795 67571 +776
Branches 9507 9594 +87
==========================================
+ Hits 44543 46502 +1959
+ Misses 19572 18241 -1331
- Partials 2680 2828 +148 |
DrTodd13
left a comment
There was a problem hiding this comment.
If loc also goes through this same new routine then create a test for it as well?
| without negative start/stop indices. stop is None implies the slice | ||
| goes from start to the beginning in reverse order. | ||
| """ | ||
| start, stop, step = slobj.indices(nrows) |
There was a problem hiding this comment.
Will .loc also go through this routine? If so, then is stop = None correct? Should start here also get a similar negative check that stop has?
There was a problem hiding this comment.
Since the stop is exclusive, there is no way to represent the beginning of a list in reverse order since 0 would exclude the first element and -1 would imply the last element, which is why I am using None here. Since the start is inclusive then I don't think there needs to be a similar negative check.
From testing I think loc takes this same code path but it seems to work. Any particular reason it wouldn't work here?
There was a problem hiding this comment.
In the tests, we cover missing/None indices, positive indices, and negative indices, the part that was missing was negative step, which I add in this PR, so we should have all the cases covered.
ehsantn
left a comment
There was a problem hiding this comment.
Thanks @scott-routledge2 .
Changes included in this PR
Some tests like those in
unique_test.pyhave non-deterministic results that are both correct, to avoid too many testing fixes, we can mark these types of tests as "skip if multiple workers". We can also catch different issues running tests on one worker vs multiple. Narwhals tests are pretty quick to run (~3 minutes to run both single and multiple works)Testing strategy
Extended
test_sliceto add a case for negative stepUser facing changes
Bug with slicing a Series with negative step fixed
Checklist
[run CI]in your commit message.