From 305dee7bf979ed3a9e2ce7507a37a6fc484e5263 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Fri, 11 May 2018 00:18:00 +0430 Subject: [PATCH] Increased django.utils.translation.trans_null test coverage. --- tests/i18n/tests.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index 6ad7752d853..d839fa5e943 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -297,6 +297,11 @@ class TranslationTests(SimpleTestCase): with translation.override(None): self.assertIs(get_language_bidi(), False) + def test_language_bidi_null(self): + self.assertIs(trans_null.get_language_bidi(), False) + with override_settings(LANGUAGE_CODE='he'): + self.assertIs(get_language_bidi(), True) + class TranslationThreadSafetyTests(SimpleTestCase): @@ -1649,6 +1654,9 @@ class CountrySpecificLanguageTests(SimpleTestCase): self.assertFalse(check_for_language('tr-TR.UTF8')) self.assertFalse(check_for_language('de-DE.utf-8')) + def test_check_for_language_null(self): + self.assertIs(trans_null.check_for_language('en'), True) + def test_get_language_from_request(self): # issue 19919 r = self.rf.get('/') @@ -1662,6 +1670,13 @@ class CountrySpecificLanguageTests(SimpleTestCase): lang = get_language_from_request(r) self.assertEqual('bg', lang) + def test_get_language_from_request_null(self): + lang = trans_null.get_language_from_request(None) + self.assertEqual(lang, 'en') + with override_settings(LANGUAGE_CODE='de'): + lang = trans_null.get_language_from_request(None) + self.assertEqual(lang, 'de') + def test_specific_language_codes(self): # issue 11915 r = self.rf.get('/')