|
3 | 3 |
|
4 | 4 | import pandas as pd
|
5 | 5 | import pandas._testing as tm
|
| 6 | +from pandas.core.arrays import IntervalArray |
6 | 7 |
|
7 | 8 |
|
8 | 9 | class TestSeriesReplace:
|
@@ -414,13 +415,13 @@ def test_replace_only_one_dictlike_arg(self):
|
414 | 415 | (pd.Series([1, 2], dtype="int64"), {1: 10, 2: 20}, "int64"),
|
415 | 416 | (pd.Series([True, False], dtype="bool"), {True: False}, "bool"),
|
416 | 417 | (
|
417 |
| - pd.Series(pd.interval_range(0, 5), dtype=pd.IntervalDtype("int64")), |
418 |
| - {pd.Interval(0, 1): pd.Interval(10, 20)}, |
| 418 | + pd.Series(IntervalArray.from_breaks([1, 2, 3, 4]), dtype=pd.IntervalDtype("int64")), |
| 419 | + {pd.Interval(1, 2): pd.Interval(10, 20)}, |
419 | 420 | "interval[int64]",
|
420 | 421 | ),
|
421 | 422 | (
|
422 |
| - pd.Series(pd.interval_range(0, 1), dtype=pd.IntervalDtype("float64")), |
423 |
| - {pd.Interval(0.0, 1.0): pd.Interval(0.2, 0.3)}, |
| 423 | + pd.Series(IntervalArray.from_breaks([1, 2, 3, 4]), dtype=pd.IntervalDtype("float64")), |
| 424 | + {pd.Interval(1, 2): pd.Interval(0.2, 0.3)}, |
424 | 425 | "interval[float64]",
|
425 | 426 | ),
|
426 | 427 | (
|
@@ -449,5 +450,5 @@ def test_replace_only_one_dictlike_arg(self):
|
449 | 450 | )
|
450 | 451 | def test_replace_dtype(self, series, to_replace, expected):
|
451 | 452 | # GH 33484
|
452 |
| - result = str(series.replace(to_replace).dtype) |
| 453 | + result = series.replace(to_replace).dtype |
453 | 454 | assert expected == result
|
0 commit comments