Added missing test for LocalizedValue __init__

This commit is contained in:
Swen Kooij 2017-02-02 15:04:01 +02:00
parent 9a976d5ec8
commit d740d442b2

View File

@ -1,9 +1,9 @@
from django.conf import settings from django.conf import settings
from django.db.utils import IntegrityError
from django.test import TestCase from django.test import TestCase
from django.utils import translation from django.utils import translation
from django.db.utils import IntegrityError
from localized_fields import LocalizedField, LocalizedFieldForm, LocalizedValue from localized_fields import LocalizedField, LocalizedValue, LocalizedFieldForm
def get_init_values() -> dict: def get_init_values() -> dict:
@ -141,6 +141,14 @@ class LocalizedValueTestCase(TestCase):
assert args[0] == keys assert args[0] == keys
@staticmethod
def test_construct_string():
"""Tests whether the :see:LocalizedValue's constructor
assumes the primary language when passing a single string."""
value = LocalizedValue('beer')
assert value.get(settings.LANGUAGE_CODE) == 'beer'
class LocalizedFieldTestCase(TestCase): class LocalizedFieldTestCase(TestCase):
"""Tests the :see:LocalizedField class.""" """Tests the :see:LocalizedField class."""