Ejemplo n.º 1
0
    def test_construct_invalid_overrides(self):
        cfg = get_simple_override_config()
        cfg[0] = 'not a dictionary'
        overrides = _generate_overrides(cfg)

        override_names_and_types = [
            ('override_variant_2', EqualNode),
            ('override_variant_3', EqualNode),
            ('override_variant_1', EqualNode),
        ]

        for i, override in enumerate(overrides):
            self.assertEqual(len(overrides[i]), 1)
            variant_name, override_type = override_names_and_types[i]
            self.assertTrue(isinstance(override[variant_name], override_type))

        self.assertEqual(len(overrides), 3)
Ejemplo n.º 2
0
    def test_construct_override(self):
        cfg = get_simple_override_config()
        overrides = _generate_overrides(cfg)

        self.assertEqual(len(overrides), 4)

        override_names_and_types = [
            ("override_variant_1", EqualNode),
            ("override_variant_2", EqualNode),
            ("override_variant_3", EqualNode),
            ("override_variant_1", EqualNode),
        ]

        for i, override in enumerate(overrides):
            self.assertEqual(len(overrides[i]), 1)
            variant_name, override_type = override_names_and_types[i]
            self.assertTrue(isinstance(override[variant_name], override_type))
Ejemplo n.º 3
0
    def test_construct_invalid_override(self):
        cfg = get_simple_override_config()
        cfg[1]['override_variant_2'] = {'EQUAL': {'field':'user_id', 'value':'t2_1'}}
        overrides = _generate_overrides(cfg)

        override_names_and_types = [
            ('override_variant_1', EqualNode),
            ('override_variant_2', OverrideNode),
            ('override_variant_3', EqualNode),
            ('override_variant_1', EqualNode),
        ]

        for i, override in enumerate(overrides):
            self.assertEqual(len(overrides[i]),1)
            variant_name, override_type = override_names_and_types[i]
            self.assertTrue(isinstance(override[variant_name], override_type))

        self.assertEqual(len(overrides),4)
Ejemplo n.º 4
0
    def test_construct_invalid_override(self):
        cfg = get_simple_override_config()
        cfg[1]["override_variant_2"] = {"EQUAL": {"field": "user_id", "value": "t2_1"}}
        overrides = _generate_overrides(cfg)

        override_names_and_types = [
            ("override_variant_1", EqualNode),
            ("override_variant_2", OverrideNode),
            ("override_variant_3", EqualNode),
            ("override_variant_1", EqualNode),
        ]

        for i, override in enumerate(overrides):
            self.assertEqual(len(overrides[i]), 1)
            variant_name, override_type = override_names_and_types[i]
            self.assertTrue(isinstance(override[variant_name], override_type))

        self.assertEqual(len(overrides), 4)
Ejemplo n.º 5
0
    def test_construct_override_dict_input(self):
        cfg = get_dict_override_config()
        overrides = _generate_overrides(cfg)

        self.assertIs(overrides, None)