Skip to content

Commit 74886c9

Browse files
committed
Sort features.py tests.
1 parent b7d1ae1 commit 74886c9

File tree

2 files changed

+17
-26
lines changed

2 files changed

+17
-26
lines changed

django_mongodb/compiler.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ class SQLCompiler(compiler.SQLCompiler):
2121
query_class = MongoQuery
2222
SEPARATOR = "10__MESSI__3"
2323

24+
def __init__(self, *args, **kwargs):
25+
super().__init__(*args, **kwargs)
26+
self._group_pipeline = None
27+
2428
def _get_group_alias_column(self, col, annotation_group_idx):
2529
"""Generate alias and replacement for group columns."""
2630
replacement = None
@@ -182,8 +186,6 @@ def pre_sql_setup(self, with_col_aliases=False):
182186
}
183187
)
184188
self._group_pipeline = pipeline
185-
else:
186-
self._group_pipeline = None
187189

188190
self.annotations = {
189191
target: expr.replace_expressions(all_replacements)
@@ -503,7 +505,6 @@ def insert(self, docs, returning_fields=None):
503505

504506
class SQLDeleteCompiler(compiler.SQLDeleteCompiler, SQLCompiler):
505507
def execute_sql(self, result_type=MULTI):
506-
self.pre_sql_setup()
507508
cursor = Cursor()
508509
cursor.rowcount = self.build_query().delete()
509510
return cursor

django_mongodb/features.py

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def django_test_expected_failures(self):
142142
"expressions.tests.BasicExpressionsTests.test_object_create_with_aggregate",
143143
"expressions.tests.BasicExpressionsTests.test_object_create_with_f_expression_in_subquery",
144144
# PI()
145+
"aggregation.tests.AggregateTestCase.test_aggregation_default_using_decimal_from_database",
145146
"db_functions.math.test_round.RoundTests.test_decimal_with_precision",
146147
"db_functions.math.test_round.RoundTests.test_float_with_precision",
147148
},
@@ -289,8 +290,13 @@ def django_test_expected_failures(self):
289290
"timezones.tests.NewDatabaseTests.test_query_annotation",
290291
},
291292
"Exists is not supported on MongoDB.": {
293+
"aggregation.test_filter_argument.FilteredAggregateTests.test_filtered_aggregate_on_exists",
292294
"aggregation.test_filter_argument.FilteredAggregateTests.test_filtered_aggregate_ref_multiple_subquery_annotation",
293295
"annotations.tests.NonAggregateAnnotationTestCase.test_annotation_exists_none_query",
296+
"aggregation.tests.AggregateTestCase.test_aggregation_exists_multivalued_outeref",
297+
"aggregation.tests.AggregateTestCase.test_group_by_exists_annotation",
298+
"aggregation.tests.AggregateTestCase.test_exists_none_with_aggregate",
299+
"aggregation.tests.AggregateTestCase.test_exists_extra_where_with_aggregate",
294300
"delete_regress.tests.DeleteTests.test_self_reference_with_through_m2m_at_second_level",
295301
"expressions.tests.BasicExpressionsTests.test_annotation_with_deeply_nested_outerref",
296302
"expressions.tests.BasicExpressionsTests.test_boolean_expression_combined",
@@ -370,6 +376,9 @@ def django_test_expected_failures(self):
370376
"aggregation.test_filter_argument.FilteredAggregateTests.test_filtered_aggregate_ref_subquery_annotation",
371377
},
372378
"Using a QuerySet in annotate() is not supported on MongoDB.": {
379+
"aggregation.tests.AggregateTestCase.test_filter_in_subquery_or_aggregation",
380+
"aggregation.tests.AggregateTestCase.test_group_by_subquery_annotation",
381+
"aggregation.tests.AggregateTestCase.test_group_by_reference_subquery",
373382
"annotations.tests.NonAggregateAnnotationTestCase.test_annotation_and_alias_filter_in_subquery",
374383
"annotations.tests.NonAggregateAnnotationTestCase.test_annotation_and_alias_filter_related_in_subquery",
375384
"annotations.tests.NonAggregateAnnotationTestCase.test_empty_expression_annotation",
@@ -443,6 +452,7 @@ def django_test_expected_failures(self):
443452
"one_to_one.tests.OneToOneTests.test_o2o_primary_key_delete",
444453
},
445454
"QuerySet.dates() is not supported on MongoDB.": {
455+
"aggregation.tests.AggregateTestCase.test_dates_with_aggregation",
446456
"annotations.tests.AliasTests.test_dates_alias",
447457
"dates.tests.DatesTests.test_dates_trunc_datetime_fields",
448458
"dates.tests.DatesTests.test_related_model_traverse",
@@ -514,6 +524,9 @@ def django_test_expected_failures(self):
514524
"update.tests.AdvancedTests.test_update_annotated_multi_table_queryset",
515525
},
516526
"Test inspects query for SQL": {
527+
"aggregation.tests.AggregateAnnotationPruningTests.test_unreferenced_aggregate_annotation_pruned",
528+
"aggregation.tests.AggregateAnnotationPruningTests.test_unused_aliased_aggregate_pruned",
529+
"aggregation.tests.AggregateAnnotationPruningTests.test_referenced_aggregate_annotation_kept",
517530
"aggregation.tests.AggregateTestCase.test_count_star",
518531
"delete.tests.DeletionTests.test_only_referenced_fields_selected",
519532
"lookup.tests.LookupTests.test_in_ignore_none",
@@ -623,35 +636,12 @@ def django_test_expected_failures(self):
623636
},
624637
"Test not applicable for MongoDB's SQLCompiler.": {
625638
"queries.test_iterator.QuerySetIteratorTests",
626-
},
627-
"skip agg": {
628-
"aggregation.test_filter_argument.FilteredAggregateTests.test_filtered_aggregate_on_exists",
629639
# Custom aggregations:
630640
"aggregation.tests.AggregateAnnotationPruningTests.test_non_aggregate_annotation_pruned",
631641
"aggregation.tests.AggregateTestCase.test_add_implementation",
632642
"aggregation.tests.AggregateTestCase.test_aggregation_default_using_datetime_from_database",
633643
"aggregation.tests.AggregateTestCase.test_multi_arg_aggregate",
634-
# SQL custom values.
635644
"aggregation.tests.AggregateTestCase.test_aggregation_default_using_date_from_database",
636-
# No sql generate
637-
"aggregation.tests.AggregateAnnotationPruningTests.test_unreferenced_aggregate_annotation_pruned",
638-
"aggregation.tests.AggregateAnnotationPruningTests.test_unused_aliased_aggregate_pruned",
639-
# PI expression:
640-
"aggregation.tests.AggregateTestCase.test_aggregation_default_using_decimal_from_database",
641-
# check sql query performance
642-
"aggregation.tests.AggregateAnnotationPruningTests.test_referenced_aggregate_annotation_kept",
643-
# Using a QuerySet in annotate() is not supported on MongoDB
644-
"aggregation.tests.AggregateTestCase.test_group_by_subquery_annotation",
645-
# Query set with annotate not supported.
646-
"aggregation.tests.AggregateTestCase.test_group_by_reference_subquery",
647-
"aggregation.tests.AggregateTestCase.test_filter_in_subquery_or_aggregation",
648-
# Exists is not supported in mongodb
649-
"aggregation.tests.AggregateTestCase.test_aggregation_exists_multivalued_outeref",
650-
"aggregation.tests.AggregateTestCase.test_group_by_exists_annotation",
651-
"aggregation.tests.AggregateTestCase.test_exists_none_with_aggregate",
652-
"aggregation.tests.AggregateTestCase.test_exists_extra_where_with_aggregate",
653-
# Queryset dates not supported
654-
"aggregation.tests.AggregateTestCase.test_dates_with_aggregation",
655645
},
656646
}
657647

0 commit comments

Comments
 (0)