当前位置: 首页>>代码示例>>Python>>正文


Python Experiment.all方法代码示例

本文整理汇总了Python中sixpack.models.Experiment.all方法的典型用法代码示例。如果您正苦于以下问题:Python Experiment.all方法的具体用法?Python Experiment.all怎么用?Python Experiment.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sixpack.models.Experiment的用法示例。


在下文中一共展示了Experiment.all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_all

# 需要导入模块: from sixpack.models import Experiment [as 别名]
# 或者: from sixpack.models.Experiment import all [as 别名]
    def test_all(self):
        # there are three created in setUp()
        all_of_them = Experiment.all(self.redis)
        self.assertEqual(len(all_of_them), 3)

        exp_1 = Experiment("archive-this", ["archived", "unarchive"], self.redis)
        exp_1.save()

        all_again = Experiment.all(self.redis)
        self.assertEqual(len(all_again), 4)

        exp_1.archive()
        all_archived = Experiment.all(self.redis)
        self.assertEqual(len(all_archived), 3)

        all_with_archived = Experiment.all(self.redis, False)
        self.assertEqual(len(all_with_archived), 4)

        all_archived = Experiment.archived(self.redis)
        self.assertEqual(len(all_archived), 1)
开发者ID:spil-bahadir,项目名称:sixpack,代码行数:22,代码来源:experiment_model_test.py

示例2: test_all

# 需要导入模块: from sixpack.models import Experiment [as 别名]
# 或者: from sixpack.models.Experiment import all [as 别名]
    def test_all(self):
        # there are three created in setUp()
        all_of_them = Experiment.all(redis=self.redis)
        self.assertEqual(len(all_of_them), 3)

        exp_1 = Experiment('archive-this', ['archived', 'unarchive'], redis=self.redis)
        exp_1.save()

        all_again = Experiment.all(redis=self.redis)
        self.assertEqual(len(all_again), 4)

        exp_1.archive()
        all_archived = Experiment.all(redis=self.redis)
        self.assertEqual(len(all_archived), 3)

        all_with_archived = Experiment.all(exclude_archived=False, redis=self.redis)
        self.assertEqual(len(all_with_archived), 4)

        all_archived = Experiment.archived(redis=self.redis)
        self.assertEqual(len(all_archived), 1)
开发者ID:VPilitsyn,项目名称:sixpack,代码行数:22,代码来源:experiment_model_test.py

示例3: test_all

# 需要导入模块: from sixpack.models import Experiment [as 别名]
# 或者: from sixpack.models.Experiment import all [as 别名]
    def test_all(self):
        # there are three created in setUp()
        all_of_them = Experiment.all(redis=self.redis)
        self.assertEqual(len(all_of_them), 3)

        exp_1 = Experiment('archive-this', ['archived', 'archived2'], redis=self.redis)
        exp_1.save()

        # Check if we have 4 active experiments in total
        all_again = Experiment.all(redis=self.redis)
        self.assertEqual(len(all_again), 4)

        # Pause one experiment.
        exp_1.pause()
        # We should have 1 paused experiment in total
        all_paused = Experiment.paused(redis=self.redis)
        self.assertEqual(len(all_paused), 1)

        # We should have 3 active experiments.
        all_active_experiments = Experiment.all(redis=self.redis)
        self.assertEqual(len(all_active_experiments), 3)

        # Total, with paused and excluding archived should be 4.
        all_with_paused = Experiment.all(exclude_paused=False, redis=self.redis)
        self.assertEqual(len(all_with_paused), 4)

        # Resume the experiment
        exp_1.resume()
        # We should have 4 active experiments
        all_active_experiments = Experiment.all(redis=self.redis)
        self.assertEqual(len(all_active_experiments), 4)        

        # Archive the experiment
        exp_1.archive()
        all_active_experiments = Experiment.all(redis=self.redis)
        self.assertEqual(len(all_active_experiments), 3)

        # We should have 1 archived experiment
        all_archived = Experiment.archived(redis=self.redis)
        self.assertEqual(len(all_archived), 1)

        # Total, with archived, excluding paused should be 4
        all_with_archived = Experiment.all(exclude_archived=False, redis=self.redis)
        self.assertEqual(len(all_with_archived), 4)
开发者ID:desaraev,项目名称:sixpack,代码行数:46,代码来源:experiment_model_test.py


注:本文中的sixpack.models.Experiment.all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。