test_perfume.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:perfume 作者: leifwalsh 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号