Skip to content

Commit d740d44

Browse files
committed
Added missing test for LocalizedValue __init__
1 parent 9a976d5 commit d740d44

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/test_localized_field.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from django.conf import settings
2-
from django.db.utils import IntegrityError
32
from django.test import TestCase
43
from django.utils import translation
4+
from django.db.utils import IntegrityError
55

6-
from localized_fields import LocalizedField, LocalizedFieldForm, LocalizedValue
6+
from localized_fields import LocalizedField, LocalizedValue, LocalizedFieldForm
77

88

99
def get_init_values() -> dict:
@@ -141,6 +141,14 @@ def test_deconstruct():
141141

142142
assert args[0] == keys
143143

144+
@staticmethod
145+
def test_construct_string():
146+
"""Tests whether the :see:LocalizedValue's constructor
147+
assumes the primary language when passing a single string."""
148+
149+
value = LocalizedValue('beer')
150+
assert value.get(settings.LANGUAGE_CODE) == 'beer'
151+
144152

145153
class LocalizedFieldTestCase(TestCase):
146154
"""Tests the :see:LocalizedField class."""

0 commit comments

Comments
 (0)