def test_property_filter_to_repr(self, property_filters): property_filter = property_filters[0] query_filter = Filter(inner_filter=property_filter) r = query_filter.to_repr() self._assert_is_correct_prop_dict_for_property_filter( r['propertyFilter'], property_filter)
def test_composite_filter_to_repr(self, property_filters): composite_filter = CompositeFilter( operator=CompositeFilterOperator.AND, filters=[Filter(property_filters[0]), Filter(property_filters[1])]) query_filter = Filter(composite_filter) r = query_filter.to_repr() composite_filter_dict = r['compositeFilter'] assert composite_filter_dict['op'] == 'AND' self._assert_is_correct_prop_dict_for_property_filter( composite_filter_dict['filters'][0]['propertyFilter'], property_filters[0]) self._assert_is_correct_prop_dict_for_property_filter( composite_filter_dict['filters'][1]['propertyFilter'], property_filters[1])
def test_filter_to_repr(composite_filter): test_filter = Filter(inner_filter=composite_filter) r = test_filter.to_repr() assert r['compositeFilter'] == test_filter.inner_filter.to_repr()