test_database.py 文件源码

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

项目:aiomongo 作者: ZeoAlliance 项目源码 文件源码
def test_validate_collection(self, test_db):
        with pytest.raises(TypeError):
            await test_db.validate_collection(5)
        with pytest.raises(TypeError):
            await test_db.validate_collection(None)

        await test_db.test.insert_one({'dummy': 'object'})

        with pytest.raises(OperationFailure):
            await test_db.validate_collection('test.doesnotexist"')
        with pytest.raises(OperationFailure):
            await test_db.validate_collection(test_db.test.doesnotexist)

        assert await test_db.validate_collection('test')
        assert await test_db.validate_collection(test_db.test)
        assert await test_db.validate_collection(test_db.test, full=True)
        assert await test_db.validate_collection(test_db.test, scandata=True)
        assert await test_db.validate_collection(test_db.test, full=True, scandata=True)
        assert await test_db.validate_collection(test_db.test, True, True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号