本文整理汇总了Python中sixpack.models.Experiment.set_winner方法的典型用法代码示例。如果您正苦于以下问题:Python Experiment.set_winner方法的具体用法?Python Experiment.set_winner怎么用?Python Experiment.set_winner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sixpack.models.Experiment
的用法示例。
在下文中一共展示了Experiment.set_winner方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set_winner
# 需要导入模块: from sixpack.models import Experiment [as 别名]
# 或者: from sixpack.models.Experiment import set_winner [as 别名]
def test_set_winner(self):
exp = Experiment('test-winner', ['1', '2'], redis=self.redis)
exp.set_winner('1')
self.assertTrue(exp.winner is not None)
exp.set_winner('1')
self.assertEqual(exp.winner.name, '1')
示例2: test_set_winner
# 需要导入模块: from sixpack.models import Experiment [as 别名]
# 或者: from sixpack.models.Experiment import set_winner [as 别名]
def test_set_winner(self):
exp = Experiment("test-winner", ["1", "2"], self.redis)
exp.set_winner("1")
self.assertTrue(exp.winner is not None)
exp.set_winner("1")
self.assertEqual(exp.winner, "1")
示例3: test_reset_winner
# 需要导入模块: from sixpack.models import Experiment [as 别名]
# 或者: from sixpack.models.Experiment import set_winner [as 别名]
def test_reset_winner(self):
exp = Experiment('show-something-reset-winner', self.alternatives, redis=self.redis)
exp.save()
exp.set_winner('yes')
self.assertTrue(exp.winner is not None)
self.assertEqual(exp.winner.name, 'yes')
exp.reset_winner()
self.assertIsNone(exp.winner)
示例4: test_reset_winner
# 需要导入模块: from sixpack.models import Experiment [as 别名]
# 或者: from sixpack.models.Experiment import set_winner [as 别名]
def test_reset_winner(self):
exp = Experiment("show-something-reset-winner", self.alternatives, self.redis)
exp.save()
exp.set_winner("yes")
self.assertTrue(exp.winner is not None)
self.assertEqual(exp.winner, "yes")
exp.reset_winner()
self.assertIsNone(exp.winner)