def test_timings_in_context(self):
'''Test that timings_in_context gives us the right results.'''
in_context = analyze.timings_in_context(self.samples)
# Since each "function" has a fixed frequency, we can create
# two series with TimedeltaIndexes and align them into the
# same DataFrame, which should be what timings_in_context
# gives us.
fn1_expected = pd.Series(
1.1,
index=pd.TimedeltaIndex(
freq=pd.Timedelta('1.1s'),
start='1.1s', periods=20, name='time'))
fn2_expected = pd.Series(
1.5,
index=pd.TimedeltaIndex(
freq=pd.Timedelta('1.5s'),
start='1.5s', periods=20, name='time'))
expected = pd.DataFrame({
'fn1': fn1_expected,
'fn2': fn2_expected
})
pdt.assert_frame_equal(in_context, expected)
评论列表
文章目录