Added iadd test, fixed whatsnew · mcocdawc/pandas@428a1b3 (original) (raw)
3 files changed
lines changed
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -536,7 +536,8 @@ Deprecations | ||
| 536 | 536 | - ``Series.sortlevel`` and ``DataFrame.sortlevel`` have been deprecated in favor of ``Series.sort_index`` and ``DataFrame.sort_index`` (:issue:`15099`) |
| 537 | 537 | - importing ``concat`` from ``pandas.tools.merge`` has been deprecated in favor of imports from the ``pandas`` namespace. This should only affect explict imports (:issue:`15358`) |
| 538 | 538 | - ``Series/DataFrame/Panel.consolidate()`` been deprecated as a public method. (:issue:`15483`) |
| 539 | -- ``FrozenList.__add__`` has been depricated in favor of ``FrozenList.union`` (:issue: `15475`) | |
| 539 | +- ``FrozenList.__add__`` has been depricated. (:issue: `15475`) | |
| 540 | +- ``FrozenList.__iadd__`` has been depricated. (:issue: `15475`) | |
| 540 | 541 | |
| 541 | 542 | .. _whatsnew_0200.prior_deprecations: |
| 542 | 543 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -32,7 +32,9 @@ def __add__(self, other): | ||
| 32 | 32 | |
| 33 | 33 | def __iadd__(self, other): |
| 34 | 34 | warnings.warn("__iadd__ is deprecated, use union(...)", FutureWarning) |
| 35 | -return self.union(other) | |
| 35 | +if isinstance(other, tuple): | |
| 36 | +other = list(other) | |
| 37 | +return super(FrozenList, self).__iadd__(other) | |
| 36 | 38 | |
| 37 | 39 | # Python 2 compat |
| 38 | 40 | def __getslice__(self, i, j): |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -17,6 +17,13 @@ def setUp(self): | ||
| 17 | 17 | def test_add(self): |
| 18 | 18 | self.assert_produces_warning(FutureWarning) |
| 19 | 19 | |
| 20 | +def test_iadd(self): | |
| 21 | +q = q1 = [1, 2, 3, 4, 5] | |
| 22 | +q = FrozenList(q) | |
| 23 | +q += [1, 2, 3] | |
| 24 | +expected = FrozenList(q1 + [1, 2, 3]) | |
| 25 | +self.check_result(q, expected) | |
| 26 | + | |
| 20 | 27 | def test_union(self): |
| 21 | 28 | result = self.container.union((1, 2, 3)) |
| 22 | 29 | expected = FrozenList(self.lst + [1, 2, 3]) |