summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)