datastore_test.py 文件源码

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

项目:appbackendapi 作者: codesdk 项目源码 文件源码
def testDeterministicOutcome(self):
        # 50% chance to apply.
        self.policy.SetProbability(.5)
        # Use the pseudo random sequence derived from seed=2.
        self.policy.SetSeed(2)

        class TestModel(ndb.Model):
            pass

        TestModel().put()

        self.assertEqual(0, TestModel.query().count(3))
        self.assertEqual(0, TestModel.query().count(3))
        # Will always be applied before the third query.
        self.assertEqual(1, TestModel.query().count(3))
    # [END HRD_example_2]


# [START main]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号