summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManaia Junior <manaiajr.23@gmail.com>2021-10-22 02:55:25 -0300
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-10-22 08:19:02 +0200
commit551c997feaaa293987af8b05efc3634b93305fac (patch)
tree3967d2e5a0f4ce8fd9b6c7150b018a8154c0811b
parent9231526af4b9825583b0d3cb943f88109fd30551 (diff)
Fixed #33214 -- Added BaseDatabaseOperations.format_for_duration_arithmetic() stub method.
-rw-r--r--django/db/backends/base/operations.py6
-rw-r--r--tests/backends/base/test_operations.py5
2 files changed, 11 insertions, 0 deletions
diff --git a/django/db/backends/base/operations.py b/django/db/backends/base/operations.py
index f6a043e31f..279297ac85 100644
--- a/django/db/backends/base/operations.py
+++ b/django/db/backends/base/operations.py
@@ -74,6 +74,12 @@ class BaseDatabaseOperations:
"""
return len(objs)
+ def format_for_duration_arithmetic(self, sql):
+ raise NotImplementedError(
+ 'subclasses of BaseDatabaseOperations may require a '
+ 'format_for_duration_arithmetic() method.'
+ )
+
def cache_key_culling_sql(self):
"""
Return an SQL query that retrieves the first cache key greater than the
diff --git a/tests/backends/base/test_operations.py b/tests/backends/base/test_operations.py
index 1cfea44e83..b7b7b9e3fc 100644
--- a/tests/backends/base/test_operations.py
+++ b/tests/backends/base/test_operations.py
@@ -85,6 +85,11 @@ class SimpleDatabaseOperationTests(SimpleTestCase):
now = timezone.now()
self.assertEqual(self.ops.adapt_timefield_value(now), str(now))
+ def test_format_for_duration_arithmetic(self):
+ msg = self.may_require_msg % 'format_for_duration_arithmetic'
+ with self.assertRaisesMessage(NotImplementedError, msg):
+ self.ops.format_for_duration_arithmetic(None)
+
def test_date_extract_sql(self):
with self.assertRaisesMessage(NotImplementedError, self.may_require_msg % 'date_extract_sql'):
self.ops.date_extract_sql(None, None)