mirror of
https://github.com/django/django.git
synced 2024-12-30 21:16:26 +00:00
18 lines
628 B
Python
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)
|