Skip to content

Commit 7567fff

Browse files
committed
TST: add unit tests to verify close #1316
1 parent 070943a commit 7567fff

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

RELEASE.rst

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pandas 0.8.0
5555
DataFrame (#929, #1241)
5656
- Add 'kde' plot kind for Series/DataFrame.plot (#1059)
5757
- More flexible multiple function aggregation with GroupBy
58+
- Add pct_chagne function
5859

5960
**Improvements to existing features**
6061

pandas/tests/test_index.py

+14
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,20 @@ def test_join_non_int_index(self):
679679
right2 = other.join(self.index, how='right')
680680
self.assert_(right2.equals(self.index))
681681

682+
def test_join_non_unique(self):
683+
left = Index([4, 4, 3, 3])
684+
685+
joined, lidx, ridx = left.join(left, return_indexers=True)
686+
687+
exp_joined = Index([3, 3, 3, 3, 4, 4, 4, 4])
688+
self.assert_(joined.equals(exp_joined))
689+
690+
exp_lidx = np.array([2, 2, 3, 3, 0, 0, 1, 1], dtype=np.int64)
691+
self.assert_(np.array_equal(lidx, exp_lidx))
692+
693+
exp_ridx = np.array([2, 3, 2, 3, 0, 1, 0, 1], dtype=np.int64)
694+
self.assert_(np.array_equal(ridx, exp_ridx))
695+
682696
def test_intersection(self):
683697
other = Index([1, 2, 3, 4, 5])
684698
result = self.index.intersection(other)

pandas/tests/test_series.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2673,9 +2673,9 @@ def test_pct_change(self):
26732673
filled = self.ts.fillna(method='bfill', limit=1)
26742674
assert_series_equal(rs, filled / filled.shift(1) - 1)
26752675

2676-
# rs = self.ts.pct_change(freq='M')
2677-
# filled = self.ts.fillna(method='pad')
2678-
# assert_series_equal(rs, filled / filled.shift(freq='M') - 1)
2676+
rs = self.ts.pct_change(freq='5D')
2677+
filled = self.ts.fillna(method='pad')
2678+
assert_series_equal(rs, filled / filled.shift(freq='5D') - 1)
26792679

26802680
def test_pct_change_shift_over_nas(self):
26812681
s = Series([1., 1.5, np.nan, 2.5, 3.])

0 commit comments

Comments
 (0)