summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlexey Kotlyarov <a@koterpillar.com>2016-02-12 12:12:54 +1100
committerTim Graham <timograham@gmail.com>2016-02-15 11:44:29 -0500
commitb59f963ad2a49322725b20fac71661bd49643443 (patch)
tree9f9f8300f776e7361d2f113d499dd885d27ec934 /tests
parent1ac7fdcd136bbb7ae5476cb54f670be20178c4e2 (diff)
Fixed #26212 -- Made forms.FileField and translation.lazy_number() picklable.
Diffstat (limited to 'tests')
-rw-r--r--tests/forms_tests/tests/test_fields.py3
-rw-r--r--tests/i18n/tests.py8
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/forms_tests/tests/test_fields.py b/tests/forms_tests/tests/test_fields.py
index c4798076d3..bd33cff4fd 100644
--- a/tests/forms_tests/tests/test_fields.py
+++ b/tests/forms_tests/tests/test_fields.py
@@ -949,6 +949,9 @@ class FieldsTests(SimpleTestCase):
# with here)
self.assertTrue(f.has_changed('resume.txt', {'filename': 'resume.txt', 'content': 'My resume'}))
+ def test_file_picklable(self):
+ self.assertIsInstance(pickle.loads(pickle.dumps(FileField())), FileField)
+
# ImageField ##################################################################
@skipIf(Image is None, "Pillow is required to test ImageField")
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py
index 1e07378ec2..05c7828430 100644
--- a/tests/i18n/tests.py
+++ b/tests/i18n/tests.py
@@ -243,6 +243,14 @@ class TranslationTests(SimpleTestCase):
self.assertTrue(ungettext_lazy('%d good result', '%d good results'))
self.assertFalse(ungettext_lazy('', ''))
+ def test_ungettext_lazy_pickle(self):
+ s1 = ungettext_lazy('%d good result', '%d good results')
+ self.assertEqual(s1 % 1, '1 good result')
+ self.assertEqual(s1 % 8, '8 good results')
+ s2 = pickle.loads(pickle.dumps(s1))
+ self.assertEqual(s2 % 1, '1 good result')
+ self.assertEqual(s2 % 8, '8 good results')
+
@override_settings(LOCALE_PATHS=extended_locale_paths)
def test_pgettext(self):
trans_real._active = local()