Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit bee7573

Browse files
author
Ehsan Totoni
committed
shift tests
1 parent 6ea55de commit bee7573

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

hpat/tests/test_hiframes.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,29 @@ def test_impl(n):
7070
self.assertEqual(count_array_REPs(), 0)
7171
self.assertEqual(count_parfor_REPs(), 0)
7272

73+
def test_shift1(self):
74+
def test_impl(n):
75+
df = pd.DataFrame({'A': np.ones(n), 'B': np.random.ranf(n)})
76+
Ac = df.A.shift(1)
77+
return Ac.sum()
78+
79+
hpat_func = hpat.jit(test_impl)
80+
n = 11
81+
self.assertEqual(hpat_func(n), test_impl(n))
82+
self.assertEqual(count_array_REPs(), 0)
83+
self.assertEqual(count_parfor_REPs(), 0)
84+
85+
def test_shift2(self):
86+
def test_impl(n):
87+
df = pd.DataFrame({'A': np.ones(n), 'B': np.random.ranf(n)})
88+
Ac = df.A.pct_change()
89+
return Ac.sum()
90+
91+
hpat_func = hpat.jit(test_impl)
92+
n = 11
93+
self.assertEqual(hpat_func(n), test_impl(n))
94+
self.assertEqual(count_array_REPs(), 0)
95+
self.assertEqual(count_parfor_REPs(), 0)
96+
7397
if __name__ == "__main__":
7498
unittest.main()

0 commit comments

Comments
 (0)