Skip to content

Commit ff0894d

Browse files
committed
Sort features.py tests.
1 parent 7e80c1a commit ff0894d

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
@@ -145,6 +145,7 @@ def django_test_expected_failures(self):
145145
"expressions.tests.BasicExpressionsTests.test_object_create_with_aggregate",
146146
"expressions.tests.BasicExpressionsTests.test_object_create_with_f_expression_in_subquery",
147147
# PI()
148+
"aggregation.tests.AggregateTestCase.test_aggregation_default_using_decimal_from_database",
148149
"db_functions.math.test_round.RoundTests.test_decimal_with_precision",
149150
"db_functions.math.test_round.RoundTests.test_float_with_precision",
150151
},
@@ -292,8 +293,13 @@ def django_test_expected_failures(self):
292293
"timezones.tests.NewDatabaseTests.test_query_annotation",
293294
},
294295
"Exists is not supported on MongoDB.": {
296+
"aggregation.test_filter_argument.FilteredAggregateTests.test_filtered_aggregate_on_exists",
295297
"aggregation.test_filter_argument.FilteredAggregateTests.test_filtered_aggregate_ref_multiple_subquery_annotation",
296298
"annotations.tests.NonAggregateAnnotationTestCase.test_annotation_exists_none_query",
299+
"aggregation.tests.AggregateTestCase.test_aggregation_exists_multivalued_outeref",
300+
"aggregation.tests.AggregateTestCase.test_group_by_exists_annotation",
301+
"aggregation.tests.AggregateTestCase.test_exists_none_with_aggregate",
302+
"aggregation.tests.AggregateTestCase.test_exists_extra_where_with_aggregate",
297303
"delete_regress.tests.DeleteTests.test_self_reference_with_through_m2m_at_second_level",
298304
"expressions.tests.BasicExpressionsTests.test_annotation_with_deeply_nested_outerref",
299305
"expressions.tests.BasicExpressionsTests.test_boolean_expression_combined",
@@ -373,6 +379,9 @@ def django_test_expected_failures(self):
373379
"aggregation.test_filter_argument.FilteredAggregateTests.test_filtered_aggregate_ref_subquery_annotation",
374380
},
375381
"Using a QuerySet in annotate() is not supported on MongoDB.": {
382+
"aggregation.tests.AggregateTestCase.test_filter_in_subquery_or_aggregation",
383+
"aggregation.tests.AggregateTestCase.test_group_by_subquery_annotation",
384+
"aggregation.tests.AggregateTestCase.test_group_by_reference_subquery",
376385
"annotations.tests.NonAggregateAnnotationTestCase.test_annotation_and_alias_filter_in_subquery",
377386
"annotations.tests.NonAggregateAnnotationTestCase.test_annotation_and_alias_filter_related_in_subquery",
378387
"annotations.tests.NonAggregateAnnotationTestCase.test_empty_expression_annotation",
@@ -446,6 +455,7 @@ def django_test_expected_failures(self):
446455
"one_to_one.tests.OneToOneTests.test_o2o_primary_key_delete",
447456
},
448457
"QuerySet.dates() is not supported on MongoDB.": {
458+
"aggregation.tests.AggregateTestCase.test_dates_with_aggregation",
449459
"annotations.tests.AliasTests.test_dates_alias",
450460
"dates.tests.DatesTests.test_dates_trunc_datetime_fields",
451461
"dates.tests.DatesTests.test_related_model_traverse",
@@ -517,6 +527,9 @@ def django_test_expected_failures(self):
517527
"update.tests.AdvancedTests.test_update_annotated_multi_table_queryset",
518528
},
519529
"Test inspects query for SQL": {
530+
"aggregation.tests.AggregateAnnotationPruningTests.test_unreferenced_aggregate_annotation_pruned",
531+
"aggregation.tests.AggregateAnnotationPruningTests.test_unused_aliased_aggregate_pruned",
532+
"aggregation.tests.AggregateAnnotationPruningTests.test_referenced_aggregate_annotation_kept",
520533
"aggregation.tests.AggregateTestCase.test_count_star",
521534
"delete.tests.DeletionTests.test_only_referenced_fields_selected",
522535
"lookup.tests.LookupTests.test_in_ignore_none",
@@ -626,35 +639,12 @@ def django_test_expected_failures(self):
626639
},
627640
"Test not applicable for MongoDB's SQLCompiler.": {
628641
"queries.test_iterator.QuerySetIteratorTests",
629-
},
630-
"skip agg": {
631-
"aggregation.test_filter_argument.FilteredAggregateTests.test_filtered_aggregate_on_exists",
632642
# Custom aggregations:
633643
"aggregation.tests.AggregateAnnotationPruningTests.test_non_aggregate_annotation_pruned",
634644
"aggregation.tests.AggregateTestCase.test_add_implementation",
635645
"aggregation.tests.AggregateTestCase.test_aggregation_default_using_datetime_from_database",
636646
"aggregation.tests.AggregateTestCase.test_multi_arg_aggregate",
637-
# SQL custom values.
638647
"aggregation.tests.AggregateTestCase.test_aggregation_default_using_date_from_database",
639-
# No sql generate
640-
"aggregation.tests.AggregateAnnotationPruningTests.test_unreferenced_aggregate_annotation_pruned",
641-
"aggregation.tests.AggregateAnnotationPruningTests.test_unused_aliased_aggregate_pruned",
642-
# PI expression:
643-
"aggregation.tests.AggregateTestCase.test_aggregation_default_using_decimal_from_database",
644-
# check sql query performance
645-
"aggregation.tests.AggregateAnnotationPruningTests.test_referenced_aggregate_annotation_kept",
646-
# Using a QuerySet in annotate() is not supported on MongoDB
647-
"aggregation.tests.AggregateTestCase.test_group_by_subquery_annotation",
648-
# Query set with annotate not supported.
649-
"aggregation.tests.AggregateTestCase.test_group_by_reference_subquery",
650-
"aggregation.tests.AggregateTestCase.test_filter_in_subquery_or_aggregation",
651-
# Exists is not supported in mongodb
652-
"aggregation.tests.AggregateTestCase.test_aggregation_exists_multivalued_outeref",
653-
"aggregation.tests.AggregateTestCase.test_group_by_exists_annotation",
654-
"aggregation.tests.AggregateTestCase.test_exists_none_with_aggregate",
655-
"aggregation.tests.AggregateTestCase.test_exists_extra_where_with_aggregate",
656-
# Queryset dates not supported
657-
"aggregation.tests.AggregateTestCase.test_dates_with_aggregation",
658648
},
659649
}
660650

0 commit comments

Comments
 (0)