|
9 | 9 | import numpy as np |
10 | 10 | import pandas as pd |
11 | 11 |
|
12 | | -from pandas import Series, DataFrame, bdate_range, isna, compat |
| 12 | +from pandas import (Series, DataFrame, bdate_range, |
| 13 | + isna, compat, _np_version_under1p12) |
13 | 14 | from pandas.tseries.offsets import BDay |
14 | 15 | import pandas.util.testing as tm |
15 | 16 | from pandas.compat import range |
@@ -527,8 +528,13 @@ def test_numpy_take(self): |
527 | 528 | sp = SparseSeries([1.0, 2.0, 3.0]) |
528 | 529 | indices = [1, 2] |
529 | 530 |
|
530 | | - tm.assert_series_equal(np.take(sp, indices, axis=0).to_dense(), |
531 | | - np.take(sp.to_dense(), indices, axis=0)) |
| 531 | + # gh-17352: older versions of numpy don't properly |
| 532 | + # pass in arguments to downstream .take() implementations. |
| 533 | + warning = FutureWarning if _np_version_under1p12 else None |
| 534 | + |
| 535 | + with tm.assert_produces_warning(warning): |
| 536 | + tm.assert_series_equal(np.take(sp, indices, axis=0).to_dense(), |
| 537 | + np.take(sp.to_dense(), indices, axis=0)) |
532 | 538 |
|
533 | 539 | msg = "the 'out' parameter is not supported" |
534 | 540 | tm.assert_raises_regex(ValueError, msg, np.take, |
|
0 commit comments