From d740d442b204a618c597a055ae92d9afec837d76 Mon Sep 17 00:00:00 2001 From: Swen Kooij Date: Thu, 2 Feb 2017 15:04:01 +0200 Subject: [PATCH] Added missing test for LocalizedValue __init__ --- tests/test_localized_field.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/test_localized_field.py b/tests/test_localized_field.py index 840a94b..313bca5 100644 --- a/tests/test_localized_field.py +++ b/tests/test_localized_field.py @@ -1,9 +1,9 @@ from django.conf import settings -from django.db.utils import IntegrityError from django.test import TestCase 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: @@ -141,6 +141,14 @@ class LocalizedValueTestCase(TestCase): 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): """Tests the :see:LocalizedField class."""