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))
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())
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())
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())