Skip to content

Commit ff97544

Browse files
WaVEVtimgraham
authored andcommitted
Sort features.py tests.
1 parent 2d6418d commit ff97544

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)
@@ -501,7 +503,6 @@ def insert(self, docs, returning_fields=None):
501503

502504
class SQLDeleteCompiler(compiler.SQLDeleteCompiler, SQLCompiler):
503505
def execute_sql(self, result_type=MULTI):
504-
self.pre_sql_setup()
505506
cursor = Cursor()
506507
cursor.rowcount = self.build_query().delete()
507508
return cursor

django_mongodb/features.py

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def django_test_expected_failures(self):
139139
"expressions.tests.BasicExpressionsTests.test_object_create_with_aggregate",
140140
"expressions.tests.BasicExpressionsTests.test_object_create_with_f_expression_in_subquery",
141141
# PI()
142+
"aggregation.tests.AggregateTestCase.test_aggregation_default_using_decimal_from_database",
142143
"db_functions.math.test_round.RoundTests.test_decimal_with_precision",
143144
"db_functions.math.test_round.RoundTests.test_float_with_precision",
144145
},
@@ -286,8 +287,13 @@ def django_test_expected_failures(self):
286287
"timezones.tests.NewDatabaseTests.test_query_annotation",
287288
},
288289
"Exists is not supported on MongoDB.": {
290+
"aggregation.test_filter_argument.FilteredAggregateTests.test_filtered_aggregate_on_exists",
289291
"aggregation.test_filter_argument.FilteredAggregateTests.test_filtered_aggregate_ref_multiple_subquery_annotation",
290292
"annotations.tests.NonAggregateAnnotationTestCase.test_annotation_exists_none_query",
293+
"aggregation.tests.AggregateTestCase.test_aggregation_exists_multivalued_outeref",
294+
"aggregation.tests.AggregateTestCase.test_group_by_exists_annotation",
295+
"aggregation.tests.AggregateTestCase.test_exists_none_with_aggregate",
296+
"aggregation.tests.AggregateTestCase.test_exists_extra_where_with_aggregate",
291297
"delete_regress.tests.DeleteTests.test_self_reference_with_through_m2m_at_second_level",
292298
"expressions.tests.BasicExpressionsTests.test_annotation_with_deeply_nested_outerref",
293299
"expressions.tests.BasicExpressionsTests.test_boolean_expression_combined",
@@ -367,6 +373,9 @@ def django_test_expected_failures(self):
367373
"aggregation.test_filter_argument.FilteredAggregateTests.test_filtered_aggregate_ref_subquery_annotation",
368374
},
369375
"Using a QuerySet in annotate() is not supported on MongoDB.": {
376+
"aggregation.tests.AggregateTestCase.test_filter_in_subquery_or_aggregation",
377+
"aggregation.tests.AggregateTestCase.test_group_by_subquery_annotation",
378+
"aggregation.tests.AggregateTestCase.test_group_by_reference_subquery",
370379
"annotations.tests.NonAggregateAnnotationTestCase.test_annotation_and_alias_filter_in_subquery",
371380
"annotations.tests.NonAggregateAnnotationTestCase.test_annotation_and_alias_filter_related_in_subquery",
372381
"annotations.tests.NonAggregateAnnotationTestCase.test_empty_expression_annotation",
@@ -444,6 +453,7 @@ def django_test_expected_failures(self):
444453
"queries.tests.Queries5Tests.test_ticket9848",
445454
},
446455
"QuerySet.dates() is not supported on MongoDB.": {
456+
"aggregation.tests.AggregateTestCase.test_dates_with_aggregation",
447457
"annotations.tests.AliasTests.test_dates_alias",
448458
"dates.tests.DatesTests.test_dates_trunc_datetime_fields",
449459
"dates.tests.DatesTests.test_related_model_traverse",
@@ -515,6 +525,9 @@ def django_test_expected_failures(self):
515525
"update.tests.AdvancedTests.test_update_annotated_multi_table_queryset",
516526
},
517527
"Test inspects query for SQL": {
528+
"aggregation.tests.AggregateAnnotationPruningTests.test_unreferenced_aggregate_annotation_pruned",
529+
"aggregation.tests.AggregateAnnotationPruningTests.test_unused_aliased_aggregate_pruned",
530+
"aggregation.tests.AggregateAnnotationPruningTests.test_referenced_aggregate_annotation_kept",
518531
"aggregation.tests.AggregateTestCase.test_count_star",
519532
"delete.tests.DeletionTests.test_only_referenced_fields_selected",
520533
"lookup.tests.LookupTests.test_in_ignore_none",
@@ -624,35 +637,12 @@ def django_test_expected_failures(self):
624637
},
625638
"Test not applicable for MongoDB's SQLCompiler.": {
626639
"queries.test_iterator.QuerySetIteratorTests",
627-
},
628-
"skip agg": {
629-
"aggregation.test_filter_argument.FilteredAggregateTests.test_filtered_aggregate_on_exists",
630640
# Custom aggregations:
631641
"aggregation.tests.AggregateAnnotationPruningTests.test_non_aggregate_annotation_pruned",
632642
"aggregation.tests.AggregateTestCase.test_add_implementation",
633643
"aggregation.tests.AggregateTestCase.test_aggregation_default_using_datetime_from_database",
634644
"aggregation.tests.AggregateTestCase.test_multi_arg_aggregate",
635-
# SQL custom values.
636645
"aggregation.tests.AggregateTestCase.test_aggregation_default_using_date_from_database",
637-
# No sql generate
638-
"aggregation.tests.AggregateAnnotationPruningTests.test_unreferenced_aggregate_annotation_pruned",
639-
"aggregation.tests.AggregateAnnotationPruningTests.test_unused_aliased_aggregate_pruned",
640-
# PI expression:
641-
"aggregation.tests.AggregateTestCase.test_aggregation_default_using_decimal_from_database",
642-
# check sql query performance
643-
"aggregation.tests.AggregateAnnotationPruningTests.test_referenced_aggregate_annotation_kept",
644-
# Using a QuerySet in annotate() is not supported on MongoDB
645-
"aggregation.tests.AggregateTestCase.test_group_by_subquery_annotation",
646-
# Query set with annotate not supported.
647-
"aggregation.tests.AggregateTestCase.test_group_by_reference_subquery",
648-
"aggregation.tests.AggregateTestCase.test_filter_in_subquery_or_aggregation",
649-
# Exists is not supported in mongodb
650-
"aggregation.tests.AggregateTestCase.test_aggregation_exists_multivalued_outeref",
651-
"aggregation.tests.AggregateTestCase.test_group_by_exists_annotation",
652-
"aggregation.tests.AggregateTestCase.test_exists_none_with_aggregate",
653-
"aggregation.tests.AggregateTestCase.test_exists_extra_where_with_aggregate",
654-
# Queryset dates not supported
655-
"aggregation.tests.AggregateTestCase.test_dates_with_aggregation",
656646
},
657647
}
658648

0 commit comments

Comments
 (0)