From c069ee0b9dd823899bd7095deadf167cd426c0b7 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Wed, 27 Oct 2021 17:13:40 +0200 Subject: [PATCH] Fixed #33224 -- Removed DatabaseFeatures.supports_mixed_date_datetime_comparisons. --- django/db/backends/base/features.py | 3 --- django/db/backends/sqlite3/features.py | 6 +++++- tests/expressions/tests.py | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/django/db/backends/base/features.py b/django/db/backends/base/features.py index def23ed187..8654293146 100644 --- a/django/db/backends/base/features.py +++ b/django/db/backends/base/features.py @@ -112,9 +112,6 @@ class BaseDatabaseFeatures: # deferred can_defer_constraint_checks = False - # date_interval_sql can properly handle mixed Date/DateTime fields and timedeltas - supports_mixed_date_datetime_comparisons = True - # Does the backend support tablespaces? Default to False because it isn't # in the SQL standard. supports_tablespaces = False diff --git a/django/db/backends/sqlite3/features.py b/django/db/backends/sqlite3/features.py index ea65f72b33..2743ec547a 100644 --- a/django/db/backends/sqlite3/features.py +++ b/django/db/backends/sqlite3/features.py @@ -18,7 +18,6 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_unspecified_pk = True supports_timezones = False max_query_params = 999 - supports_mixed_date_datetime_comparisons = False supports_transactions = True atomic_transactions = False can_rollback_ddl = True @@ -50,6 +49,11 @@ class DatabaseFeatures(BaseDatabaseFeatures): 'cs': 'binary', 'non_default': 'nocase', } + django_test_expected_failures = { + # The django_format_dtdelta() function doesn't properly handle mixed + # Date/DateTime fields and timedeltas. + 'expressions.tests.FTimeDeltaTests.test_mixed_comparisons1', + } @cached_property def django_test_skips(self): diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py index 53448ed1d9..4bb65c9031 100644 --- a/tests/expressions/tests.py +++ b/tests/expressions/tests.py @@ -1473,7 +1473,6 @@ class FTimeDeltaTests(TestCase): test_set = [e.name for e in Experiment.objects.filter(completed__lte=F('assigned') + days)] self.assertEqual(test_set, self.expnames[:i + 1]) - @skipUnlessDBFeature("supports_mixed_date_datetime_comparisons") def test_mixed_comparisons1(self): for i, delay in enumerate(self.delays): test_set = [e.name for e in Experiment.objects.filter(assigned__gt=F('start') - delay)]