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


Python Experiment.save方法代码示例

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


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

示例1: test_know_if_it_is_the_control_of_an_experiment

# 需要导入模块: from flask_split.models import Experiment [as 别名]
# 或者: from flask_split.models.Experiment import save [as 别名]
 def test_know_if_it_is_the_control_of_an_experiment(self):
     experiment = Experiment(self.redis, 'basket_text', 'Basket', 'Cart')
     experiment.save()
     alternative = Alternative(self.redis, 'Basket', 'basket_text')
     assert alternative.is_control
     alternative = Alternative(self.redis, 'Cart', 'basket_text')
     assert not alternative.is_control
开发者ID:Runscope,项目名称:flask-split,代码行数:9,代码来源:test_models.py

示例2: test_increment_completed_count

# 需要导入模块: from flask_split.models import Experiment [as 别名]
# 或者: from flask_split.models.Experiment import save [as 别名]
 def test_increment_completed_count(self):
     experiment = Experiment(self.redis, 'basket_text', 'Basket', "Cart")
     experiment.save()
     alternative = Alternative(self.redis, 'Basket', 'basket_text')
     old_completed_count = alternative.participant_count
     alternative.increment_completion()
     assert alternative.completed_count == old_completed_count + 1
开发者ID:Runscope,项目名称:flask-split,代码行数:9,代码来源:test_models.py

示例3: test_saves_the_start_time_to_redis

# 需要导入模块: from flask_split.models import Experiment [as 别名]
# 或者: from flask_split.models.Experiment import save [as 别名]
 def test_saves_the_start_time_to_redis(self):
     experiment_start_time = datetime(2012, 3, 9, 22, 01, 34)
     (flexmock(Experiment)
         .should_receive('_get_time')
         .and_return(experiment_start_time))
     experiment = Experiment(self.redis, 'basket_text', 'Basket', 'Cart')
     experiment.save()
     assert experiment.start_time == experiment_start_time
开发者ID:Runscope,项目名称:flask-split,代码行数:10,代码来源:test_models.py

示例4: test_handles_not_having_a_start_time

# 需要导入模块: from flask_split.models import Experiment [as 别名]
# 或者: from flask_split.models.Experiment import save [as 别名]
    def test_handles_not_having_a_start_time(self):
        experiment_start_time = datetime(2012, 3, 9, 22, 01, 34)
        (flexmock(Experiment)
            .should_receive('_get_time')
            .and_return(experiment_start_time))
        experiment = Experiment(self.redis, 'basket_text', 'Basket', 'Cart')
        experiment.save()

        self.redis.hdel('experiment_start_times', experiment.name)

        assert experiment.start_time is None
开发者ID:Runscope,项目名称:flask-split,代码行数:13,代码来源:test_models.py

示例5: test_reset_an_experiment_if_loaded_with_different_alternatives

# 需要导入模块: from flask_split.models import Experiment [as 别名]
# 或者: from flask_split.models.Experiment import save [as 别名]
 def test_reset_an_experiment_if_loaded_with_different_alternatives(self):
     experiment = Experiment(
         self.redis, 'link_color', 'blue', 'red', 'green')
     experiment.save()
     blue = Alternative(self.redis, 'blue', 'link_color')
     blue.participant_count = 5
     blue.save()
     same_experiment = Experiment.find_or_create(
         self.redis, 'link_color', 'blue', 'yellow', 'orange')
     alternative_names = [a.name for a in same_experiment.alternatives]
     assert alternative_names == ['blue', 'yellow', 'orange']
     new_blue = Alternative(self.redis, 'blue', 'link_color')
     assert new_blue.participant_count == 0
开发者ID:Runscope,项目名称:flask-split,代码行数:15,代码来源:test_models.py

示例6: test_z_score_is_none_when_the_control_has_no_participations

# 需要导入模块: from flask_split.models import Experiment [as 别名]
# 或者: from flask_split.models.Experiment import save [as 别名]
 def test_z_score_is_none_when_the_control_has_no_participations(self):
     experiment = Experiment(self.redis, 'link_color', 'blue', 'red')
     experiment.save()
     alternative = Alternative(self.redis, 'red', 'link_color')
     assert alternative.z_score is None
开发者ID:Runscope,项目名称:flask-split,代码行数:7,代码来源:test_models.py

示例7: test_belong_to_an_experiment

# 需要导入模块: from flask_split.models import Experiment [as 别名]
# 或者: from flask_split.models.Experiment import save [as 别名]
 def test_belong_to_an_experiment(self):
     experiment = Experiment(self.redis, 'basket_text', 'Basket', 'Cart')
     experiment.save()
     alternative = Alternative(self.redis, 'Basket', 'basket_text')
     assert alternative.experiment.name == experiment.name
开发者ID:Runscope,项目名称:flask-split,代码行数:7,代码来源:test_models.py

示例8: test_control_is_the_first_alternative

# 需要导入模块: from flask_split.models import Experiment [as 别名]
# 或者: from flask_split.models.Experiment import save [as 别名]
 def test_control_is_the_first_alternative(self):
     experiment = Experiment(self.redis, 'basket_text', 'Basket', 'Cart')
     experiment.save()
     assert experiment.control.name == 'Basket'
开发者ID:Runscope,项目名称:flask-split,代码行数:6,代码来源:test_models.py

示例9: test_find_returns_an_existing_experiment

# 需要导入模块: from flask_split.models import Experiment [as 别名]
# 或者: from flask_split.models.Experiment import save [as 别名]
 def test_find_returns_an_existing_experiment(self):
     experiment = Experiment(self.redis, 'basket_text', 'Basket', 'Cart')
     experiment.save()
     assert Experiment.find(self.redis, 'basket_text').name == 'basket_text'
开发者ID:Runscope,项目名称:flask-split,代码行数:6,代码来源:test_models.py

示例10: test_is_new_record_knows_if_it_has_been_saved_yet

# 需要导入模块: from flask_split.models import Experiment [as 别名]
# 或者: from flask_split.models.Experiment import save [as 别名]
 def test_is_new_record_knows_if_it_has_been_saved_yet(self):
     experiment = Experiment(self.redis, 'basket_text', 'Basket', 'Cart')
     experiment.save()
     assert not experiment.is_new_record
开发者ID:Runscope,项目名称:flask-split,代码行数:6,代码来源:test_models.py

示例11: test_deleting_should_delete_itself

# 需要导入模块: from flask_split.models import Experiment [as 别名]
# 或者: from flask_split.models.Experiment import save [as 别名]
    def test_deleting_should_delete_itself(self):
        experiment = Experiment(self.redis, 'basket_text', 'Basket', 'Cart')
        experiment.save()

        experiment.delete()
        assert 'basket_text' not in self.redis
开发者ID:Runscope,项目名称:flask-split,代码行数:8,代码来源:test_models.py

示例12: test_does_not_create_duplicates_when_saving_multiple_times

# 需要导入模块: from flask_split.models import Experiment [as 别名]
# 或者: from flask_split.models.Experiment import save [as 别名]
 def test_does_not_create_duplicates_when_saving_multiple_times(self):
     experiment = Experiment(self.redis, 'basket_text', 'Basket', 'Cart')
     experiment.save()
     experiment.save()
     assert 'basket_text' in self.redis
     assert self.redis.lrange('basket_text', 0, -1) == ['Basket', 'Cart']
开发者ID:Runscope,项目名称:flask-split,代码行数:8,代码来源:test_models.py

示例13: test_saves_to_redis

# 需要导入模块: from flask_split.models import Experiment [as 别名]
# 或者: from flask_split.models.Experiment import save [as 别名]
 def test_saves_to_redis(self):
     experiment = Experiment(self.redis, 'basket_text', 'Basket', 'Cart')
     experiment.save()
     assert 'basket_text' in self.redis
开发者ID:Runscope,项目名称:flask-split,代码行数:6,代码来源:test_models.py


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