-
Notifications
You must be signed in to change notification settings - Fork 61
Add test on Series.getitem failure #619
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1182,6 +1182,22 @@ def test_impl(A): | |
S = pd.Series(['1', '4', '6', '33', '7'], ['1', '3', '5', '4', '7'], name='A') | ||
pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) | ||
|
||
@unittest.skip('LLVM ERROR: out of memory') | ||
def test_series_getitem_idx_int_negative_slice(self): | ||
def test_impl(S, start, end): | ||
return S[start:end] | ||
|
||
jit_impl = self.jit(test_impl) | ||
|
||
starts = [0, -2] | ||
ends = [-2, 0] | ||
indices = [[2, 3, 5, 6, 7], ['2', '3', '5', '6', '7'], ['2', '3', '5', '6', '7']] | ||
for start, end, index in zip(starts, ends, indices): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would iterate over zipped sequences but until the end of the shortest one is found, so the last string index in indices won't be tested at all. |
||
S = pd.Series([11, 22, 33, 44, 55], index, name='A') | ||
ref_result = test_impl(S, start, end) | ||
jit_result = jit_impl(S, start, end) | ||
pd.testing.assert_series_equal(jit_result, ref_result) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use self.subTest context to verify each combination in a separate subtest.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kozlov-alexey as far as I get, this is negative tests for negative slices. If it would be combined with positive slices we would need to skip all tests, instead of skiping specific ones. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AlexanderKalistratov What do you mean by negative tests? That an empty slice appear as a result? If so, that's true. Otherwise, I think it should not matter whether slice has negatives or positives from the test perspective (assuming it's a correct slice). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kozlov-alexey sounds reasonable. I thought this is some kind of numba limitation (negative slices). But it seems to be our own problem. |
||
|
||
def test_series_at(self): | ||
def test_impl(S, key): | ||
return S.at[key] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would probably be better to use the same name (hpat_func) everywhere.