1
0
mirror of https://github.com/django/django.git synced 2024-12-23 09:36:06 +00:00
django/tests/from_db_value/test_deprecated.py

18 lines
628 B
Python

from django.test import TestCase
from django.utils.deprecation import RemovedInDjango30Warning
from .models import Cash, CashModelDeprecated
class FromDBValueDeprecationTests(TestCase):
def test_deprecation(self):
msg = (
'Remove the context parameter from CashFieldDeprecated.from_db_value(). '
'Support for it will be removed in Django 3.0.'
)
CashModelDeprecated.objects.create(cash='12.50')
with self.assertWarnsMessage(RemovedInDjango30Warning, msg):
instance = CashModelDeprecated.objects.get()
self.assertIsInstance(instance.cash, Cash)