Exemplo n.º 1
0
    def test_multilevel_selector_with_valid_OR_persons(self):

        filter = BASE_FILTER.with_data(
            {
                "properties": {
                    "type": "OR",
                    "values": [
                        {
                            "type": "OR",
                            "values": [
                                {"key": "event_prop2", "value": ["foo2", "bar2"], "type": "person",},
                                {"key": "person_prop2", "value": "efg2", "type": "person",},
                            ],
                        },
                        {
                            "type": "AND",
                            "values": [
                                {"key": "event_prop", "value": ["foo", "bar"], "type": "person",},
                                {"key": "person_prop", "value": "efg", "type": "person",},
                            ],
                        },
                    ],
                }
            }
        )

        self.assertTrue(PropertyOptimizer.using_only_person_properties(filter.property_groups))
Exemplo n.º 2
0
    def test_basic_selector(self):

        filter = BASE_FILTER.with_data(
            {
                "properties": {
                    "type": "OR",
                    "values": [
                        {"key": "person_prop", "value": "efg", "type": "person"},
                        {"key": "person_prop2", "value": "efg2", "type": "person"},
                    ],
                }
            }
        )
        self.assertTrue(PropertyOptimizer.using_only_person_properties(filter.property_groups))