示例#1
0
    def test_generate_targeting_valid_config(self):
        targeting_cfg = get_targeting_config()

        experiment_correct_targeting = _generate_targeting(targeting_cfg)
        self.assertTrue(isinstance(experiment_correct_targeting, Targeting))

        self.assertFalse(isinstance(experiment_correct_targeting, OverrideNode))
示例#2
0
    def test_generate_targeting_no_config(self):
        targeting_cfg = None

        experiment_correct_targeting = _generate_targeting(targeting_cfg)
        self.assertTrue(isinstance(experiment_correct_targeting, Targeting))

        self.assertTrue(isinstance(experiment_correct_targeting, OverrideNode))
        self.assertTrue(experiment_correct_targeting.evaluate())
示例#3
0
    def test_generate_targeting_invalid_config(self):
        targeting_cfg = get_targeting_config()
        targeting_cfg['ALL'][0]['ANY'][0] = {'EQUAL': {'field': 'is_mod', 'value': True}}

        experiment_correct_targeting = _generate_targeting(targeting_cfg)
        self.assertTrue(isinstance(experiment_correct_targeting, Targeting))

        self.assertTrue(isinstance(experiment_correct_targeting, OverrideNode))
        self.assertFalse(experiment_correct_targeting.evaluate())
示例#4
0
    def test_generate_targeting_invalid_config(self):
        targeting_cfg = get_targeting_config()
        targeting_cfg["ALL"][0]["ANY"][0] = {"EQUAL": {"field": "is_mod", "value": True}}

        experiment_correct_targeting = _generate_targeting(targeting_cfg)
        self.assertTrue(isinstance(experiment_correct_targeting, Targeting))

        self.assertTrue(isinstance(experiment_correct_targeting, OverrideNode))
        self.assertFalse(experiment_correct_targeting.evaluate())