mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #28370 -- Deprecated the context arg of Field.from_db_value() and Expression.convert_value().
Unused since a0d166306f.
This commit is contained in:
22
tests/from_db_value/test_deprecated.py
Normal file
22
tests/from_db_value/test_deprecated.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import warnings
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
from .models import Cash, CashModelDeprecated
|
||||
|
||||
|
||||
class FromDBValueDeprecationTests(TestCase):
|
||||
|
||||
def test_deprecation(self):
|
||||
CashModelDeprecated.objects.create(cash='12.50')
|
||||
with warnings.catch_warnings(record=True) as warns:
|
||||
warnings.simplefilter('always')
|
||||
instance = CashModelDeprecated.objects.get()
|
||||
self.assertIsInstance(instance.cash, Cash)
|
||||
self.assertEqual(len(warns), 1)
|
||||
msg = str(warns[0].message)
|
||||
self.assertEqual(
|
||||
msg,
|
||||
'Remove the context parameter from CashFieldDeprecated.from_db_value(). '
|
||||
'Support for it will be removed in Django 3.0.'
|
||||
)
|
||||
Reference in New Issue
Block a user