From d6c3a71a9ee9f751823462578249aac613587a9e Mon Sep 17 00:00:00 2001 From: MohammadMahdi Khalaj Date: Sun, 5 Nov 2023 15:43:37 +0330 Subject: [PATCH] Remove unused function --- aggify/aggify.py | 9 --------- tests/test_aggify.py | 5 ----- 2 files changed, 14 deletions(-) diff --git a/aggify/aggify.py b/aggify/aggify.py index a5cca90..121b0e8 100644 --- a/aggify/aggify.py +++ b/aggify/aggify.py @@ -357,15 +357,6 @@ def unwind( self.pipelines.append(unwind_stage) return self - def aggregate(self): - """ - Returns the aggregated results. - - Returns: - The aggregated results. - """ - return self.base_model.objects.aggregate(*self.pipelines) # type: ignore - def annotate( self, annotate_name: str, accumulator: str, f: Union[Union[str, Dict], F, int] ) -> "Aggify": diff --git a/tests/test_aggify.py b/tests/test_aggify.py index 3903188..8b1735e 100644 --- a/tests/test_aggify.py +++ b/tests/test_aggify.py @@ -486,11 +486,6 @@ def test_regex_f_with_others(self): with pytest.raises(ValueError): aggify.filter(name__contains=F("age")) - def test_aggregate_failed_connection(self): - aggify = Aggify(BaseModel) - with pytest.raises(ValueError): - aggify.filter(name__contains=F("age")).aggregate() - def test_annotate_str_field_as_value_but_not_base_model_field(self): thing = list(Aggify(BaseModel).group("name").annotate("age", "sum", "test")) assert thing[0]["$group"] == {"_id": "$name", "age": {"$sum": "test"}}