|
11 | 11 |
|
12 | 12 | from .test_numeric import Numeric |
13 | 13 |
|
| 14 | +# aliases to make some tests easier to read |
| 15 | +RI = RangeIndex |
| 16 | +I64 = Int64Index |
| 17 | +F64 = Float64Index |
| 18 | +OI = Index |
14 | 19 |
|
15 | 20 | class TestRangeIndex(Numeric): |
16 | 21 | _holder = RangeIndex |
@@ -565,22 +570,20 @@ def test_intersection(self, sort): |
565 | 570 | expected = RangeIndex(0, 0, 1) |
566 | 571 | tm.assert_index_equal(result, expected) |
567 | 572 |
|
568 | | - def test_union_noncomparable(self): |
| 573 | + @pytest.mark.parametrize('sort', [False, None]) |
| 574 | + def test_union_noncomparable(self, sort): |
569 | 575 | from datetime import datetime, timedelta |
570 | 576 | # corner case, non-Int64Index |
571 | 577 | now = datetime.now() |
572 | 578 | other = Index([now + timedelta(i) for i in range(4)], dtype=object) |
573 | | - result = self.index.union(other) |
| 579 | + result = self.index.union(other, sort=sort) |
574 | 580 | expected = Index(np.concatenate((self.index, other))) |
575 | 581 | tm.assert_index_equal(result, expected) |
576 | 582 |
|
577 | | - result = other.union(self.index) |
| 583 | + result = other.union(self.index, sort=sort) |
578 | 584 | expected = Index(np.concatenate((other, self.index))) |
579 | 585 | tm.assert_index_equal(result, expected) |
580 | 586 |
|
581 | | - RI = RangeIndex |
582 | | - I64 = Int64Index |
583 | | - |
584 | 587 | @pytest.fixture(params=[ |
585 | 588 | (RI(0, 10, 1), RI(0, 10, 1), RI(0, 10, 1), RI(0, 10, 1)), |
586 | 589 | (RI(0, 10, 1), RI(5, 20, 1), RI(0, 20, 1), I64(range(20))), |
@@ -866,10 +869,6 @@ def test_len_specialised(self): |
866 | 869 |
|
867 | 870 | def test_append(self): |
868 | 871 | # GH16212 |
869 | | - RI = RangeIndex |
870 | | - I64 = Int64Index |
871 | | - F64 = Float64Index |
872 | | - OI = Index |
873 | 872 | cases = [([RI(1, 12, 5)], RI(1, 12, 5)), |
874 | 873 | ([RI(0, 6, 4)], RI(0, 6, 4)), |
875 | 874 | ([RI(1, 3), RI(3, 7)], RI(1, 7)), |
|
0 commit comments