mirror of
https://github.com/SectorLabs/django-localized-fields.git
synced 2025-06-27 13:53:19 +03:00
Add test to make sure LocalizedValue doesn't cast values to string
This commit is contained in:
parent
d8eb3394d0
commit
af02593ebd
@ -1,6 +1,7 @@
|
||||
from django.conf import settings
|
||||
from django.test import TestCase
|
||||
from django.utils import translation
|
||||
from django.db.models import F
|
||||
|
||||
from localized_fields.value import LocalizedValue
|
||||
|
||||
@ -180,3 +181,11 @@ class LocalizedValueTestCase(TestCase):
|
||||
|
||||
value = LocalizedValue('beer')
|
||||
assert value.get(settings.LANGUAGE_CODE) == 'beer'
|
||||
|
||||
@staticmethod
|
||||
def test_construct_expression():
|
||||
"""Tests whether passing expressions as values
|
||||
works properly and are not converted to string."""
|
||||
|
||||
value = LocalizedValue(dict(en=F('other')))
|
||||
assert isinstance(value.en, F)
|
||||
|
Loading…
x
Reference in New Issue
Block a user