Beispiel #1
0
 def test_existing_accented_custom_list(self):
     self.assertEqual(_get_probe_language(['en-gb']), ['en-gb'])
Beispiel #2
0
    def test_invalid_custom_list(self):
        with self.assertRaises(ValueError) as error:
            _get_probe_language(['xx'])

        self.assertEqual(error.exception.args[0],
                         '`xx` is not a supported language.')
Beispiel #3
0
 def test_existing_accented_custom_str(self):
     self.assertEqual(_get_probe_language('en-gb'), 'en-gb')
Beispiel #4
0
 def test_unaccented_custom_list(self):
     self.assertEqual(_get_probe_language(['en']), ['en'])
Beispiel #5
0
 def test_unaccented_custom_str(self):
     self.assertEqual(_get_probe_language('en'), 'en')
Beispiel #6
0
 def test_existing_accented_active(self):
     self.assertEqual(_get_probe_language(), 'en-gb')
Beispiel #7
0
 def test_unaccented_active(self):
     self.assertEqual(_get_probe_language(), 'en')
Beispiel #8
0
 def __call__(self, lang=None):
     """Specialize the `TQ` for some language(s)."""
     obj = copy.deepcopy(self)
     obj.lang = _get_probe_language(lang)
     return obj
Beispiel #9
0
 def probe(self, lang=None):
     """Probe the `TranslatableQuerySet` in some language(s)."""
     clone = self.all()
     clone._trans_prob = _get_probe_language(lang)
     return clone