1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #35111 -- Fixed compilation of DateField __in/__range rhs on SQLite and MySQL.

Also removed tests that ensured that adapt_(date)timefield backend
operations where able to deal with expressions when it's not the case
for any other adapt methods.
This commit is contained in:
Simon Charette
2024-01-13 16:16:58 -05:00
committed by Mariusz Felisiak
parent 561f770415
commit 0fcee1676c
6 changed files with 23 additions and 40 deletions

View File

@@ -4,7 +4,7 @@ from unittest import mock
from django.core.management.color import no_style
from django.db import NotSupportedError, connection, transaction
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.models import DurationField, Value
from django.db.models import DurationField
from django.db.models.expressions import Col
from django.db.models.lookups import Exact
from django.test import (
@@ -89,17 +89,9 @@ class SimpleDatabaseOperationTests(SimpleTestCase):
def test_adapt_timefield_value_none(self):
self.assertIsNone(self.ops.adapt_timefield_value(None))
def test_adapt_timefield_value_expression(self):
value = Value(timezone.now().time())
self.assertEqual(self.ops.adapt_timefield_value(value), value)
def test_adapt_datetimefield_value_none(self):
self.assertIsNone(self.ops.adapt_datetimefield_value(None))
def test_adapt_datetimefield_value_expression(self):
value = Value(timezone.now())
self.assertEqual(self.ops.adapt_datetimefield_value(value), value)
def test_adapt_timefield_value(self):
msg = "Django does not support timezone-aware times."
with self.assertRaisesMessage(ValueError, msg):