mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	| @@ -4,6 +4,7 @@ from __future__ import unicode_literals | ||||
| from contextlib import contextmanager | ||||
| import datetime | ||||
| import decimal | ||||
| import gettext as gettext_module | ||||
| from importlib import import_module | ||||
| import os | ||||
| import pickle | ||||
| @@ -1338,3 +1339,26 @@ class CountrySpecificLanguageTests(TestCase): | ||||
|         r.META = {'HTTP_ACCEPT_LANGUAGE': 'pt-pt,en-US;q=0.8,en;q=0.6,ru;q=0.4'} | ||||
|         lang = get_language_from_request(r) | ||||
|         self.assertEqual('pt-br', lang) | ||||
|  | ||||
|  | ||||
| class TranslationFilesMissing(TestCase): | ||||
|  | ||||
|     def setUp(self): | ||||
|         super(TranslationFilesMissing, self).setUp() | ||||
|         self.gettext_find_builtin = gettext_module.find | ||||
|  | ||||
|     def tearDown(self): | ||||
|         gettext_module.find = self.gettext_find_builtin | ||||
|         super(TranslationFilesMissing, self).tearDown() | ||||
|  | ||||
|     def patchGettextFind(self): | ||||
|         gettext_module.find = lambda *args, **kw: None | ||||
|  | ||||
|     def test_failure_finding_default_mo_files(self): | ||||
|         ''' | ||||
|         Ensure IOError is raised if the default language is unparseable. | ||||
|         Refs: #18192 | ||||
|         ''' | ||||
|         self.patchGettextFind() | ||||
|         trans_real._translations = {} | ||||
|         self.assertRaises(IOError, activate, 'en') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user