test_validate.py 文件源码

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

项目:maggma 作者: materialsproject 项目源码 文件源码
def test_Timing(self):
        e = vu.ElapsedTime()
        with vu.Timing(elapsed=e):
            time.sleep(0.2)
        self.assertAlmostEqual(e.value, 0.2, places=1)
        # test some other modes of invocation
        with vu.Timing() as t:
            x = 1
        loglvl = 10
        class FakeLog:
            def __init__(self, testclass):
                self.tc = testclass
            def log(self, lvl, msg):
                self.tc.assertEqual(lvl, loglvl)
        with vu.Timing(log=FakeLog(self), level=loglvl):
            x = 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号