test_lambada.py 文件源码

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

项目:lambada 作者: Superpedestrian 项目源码 文件源码
def test_lambada_class(self):
        """Validate the base lambada class."""
        tune = lambada.Lambada()
        # Make sure we make the attributes we need
        self.assertIsNotNone(getattr(tune, 'dancers'))
        self.assertIsNotNone(getattr(tune, 'config'))

        # Create a dancer and call it
        tune.dancers['test'] = MagicMock()
        context = LambdaContext('test')
        tune('hi', context)
        tune.dancers['test'].assert_called()
        tune.dancers['test'].assert_called_with('hi', context)

        # Try a dancer that doesn't exist
        context = LambdaContext('nope')
        with assertRaisesRegex(self, Exception, 'No matching dancer'):
            tune('bye', context)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号