本文整理汇总了Python中sixpack.models.Experiment.initialize_alternatives方法的典型用法代码示例。如果您正苦于以下问题:Python Experiment.initialize_alternatives方法的具体用法?Python Experiment.initialize_alternatives怎么用?Python Experiment.initialize_alternatives使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sixpack.models.Experiment
的用法示例。
在下文中一共展示了Experiment.initialize_alternatives方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _test_initialize_alternatives
# 需要导入模块: from sixpack.models import Experiment [as 别名]
# 或者: from sixpack.models.Experiment import initialize_alternatives [as 别名]
def _test_initialize_alternatives(self):
# Should throw ValueError
with self.assertRaises(ValueError):
Experiment.initialize_alternatives('n', ['*'], redis=self.redis)
# each item in list should be Alternative Instance
alt_objs = Experiment.initialize_alternatives('n', ['1', '2', '3'])
for alt in alt_objs:
self.assertTrue(isinstance(alt, Alternative))
self.assertTrue(alt.name in ['1', '2', '3'])
示例2: _test_initialize_alternatives
# 需要导入模块: from sixpack.models import Experiment [as 别名]
# 或者: from sixpack.models.Experiment import initialize_alternatives [as 别名]
def _test_initialize_alternatives(self):
# Should throw ValueError
with self.assertRaises(ValueError):
Experiment.initialize_alternatives("n", ["*"], self.redis)
# each item in list should be Alternative Instance
alt_objs = Experiment.initialize_alternatives("n", ["1", "2", "3"])
for alt in alt_objs:
self.assertTrue(isinstance(alt, Alternative))
self.assertTrue(alt.name in ["1", "2", "3"])