def testStrOfGetTextMsg12LazyStrMixedSum(self): self._addLocaleDir("locale1") self._addLocaleDir("locale2") device = _Device() msg = locale.gettext__(_MSG1_ID) + " " + locale.gettext__(_MSG2_ID) self.failUnless(isinstance(msg, locale.MessageSum)) self.failUnlessEqual(str(msg), _MSG1_ID + " " + _MSG2_ID)
def testGetTextMsg12LazyStrsMixedSum(self): self._addLocaleDir("locale1") self._addLocaleDir("locale2") device = _Device() msg = "*" + locale.gettext__(_MSG1_ID) + " " + locale.gettext__(_MSG2_ID) + "!*" self.failUnless(isinstance(msg, locale.MessageSum)) self.failUnlessEqual(msg(device), "*" + _TRANS1 + " " + _TRANS2 + "!*")
def testGetTextMsg12LazySum(self): self._addLocaleDir("locale1") self._addLocaleDir("locale2") device = _Device() msg = locale.gettext__(_MSG1_ID) + locale.gettext__(_MSG2_ID) self.failUnless(isinstance(msg, locale.MessageSum)) self.failUnlessEqual(msg(device), _TRANS1 + _TRANS2)
def testGetTextMsg1LazyEmptyLocale(self): self._addLocaleDir("locale1") device = _Device() device.locale = '' msg = locale.gettext__(_MSG1_ID) self.failUnless(isinstance(msg, locale.LazyTranslation)) self.failUnlessEqual(msg(device), _MSG1_ID)
def testGetTextMsg1LazyStrSumFail(self): self._addLocaleDir("locale2") device = _Device() string = "..." msg = locale.gettext__(_MSG1_ID) + string self.failUnless(isinstance(msg, locale.MessageSum)) self.failUnlessEqual(msg(device), _MSG1_ID + string)
def testGetTextStrMsg1LazySum(self): self._addLocaleDir("locale1") device = _Device() string = "za" msg = string + locale.gettext__(_MSG1_ID) self.failUnless(isinstance(msg, locale.MessageSum)) self.failUnlessEqual(msg(device), string + _TRANS1)
def testGetTextMsg2LazyStrSum(self): self._addLocaleDir("locale2") device = _Device() string = "ch" msg = locale.gettext__(_MSG2_ID) + string self.failUnless(isinstance(msg, locale.MessageSum)) self.failUnlessEqual(msg(device), _TRANS2 + string)
def testNGetTextMsg2SingLazyStrsMixedSum(self): self._addLocaleDir("locale1") self._addLocaleDir("locale2") device = _Device() msg = u"Więc " + locale.ngettext__(_SING_ID, _PLUR_ID, 1) + ", " + locale.gettext__(_MSG2_ID) + "!" self.failUnless(isinstance(msg, locale.MessageSum)) self.failUnlessEqual(msg(device), u"Więc " + _SING_TRANS + ", " + _TRANS2 + "!")
def testNGetTextMsg2SingLazyStrsMixedSum(self): self._addLocaleDir("locale1") self._addLocaleDir("locale2") device = _Device() msg = u"Więc " + locale.ngettext__( _SING_ID, _PLUR_ID, 1) + ", " + locale.gettext__(_MSG2_ID) + "!" self.failUnless(isinstance(msg, locale.MessageSum)) self.failUnlessEqual(msg(device), u"Więc " + _SING_TRANS + ", " + _TRANS2 + "!")
def testGetTextMsg2Lazy(self): self._addLocaleDir("locale2") device = _Device() msg = locale.gettext__(_MSG2_ID) self.failUnless(isinstance(msg, locale.LazyTranslation)) self.failUnlessEqual(msg(device), _TRANS2)
def testMsg1LazyEscape(self): self._addLocaleDir("locale1") device = _Device() msg = locale.gettext__(_MSG1_ID) self.failUnless(isinstance(msg, locale.LazyTranslation)) self.failUnlessEqual(locale.escape(msg, device), _TRANS1)
def testGetTextMsg12LazySumFail(self): self._addLocaleDir("locale1") device = _Device() msg = locale.gettext__(_MSG1_ID) + locale.gettext__(_MSG2_ID) self.failUnless(isinstance(msg, locale.MessageSum)) self.failUnlessEqual(msg(device), _TRANS1 + _MSG2_ID)