代码拉取完成,页面将自动刷新
import os
import sys
import unittest
import resources
from stringBundle import StringBundle
class TestStringBundle(unittest.TestCase):
def test_loadDefaultBundle_withoutError(self):
str_bundle = StringBundle.get_bundle('en')
self.assertEqual(str_bundle.get_string("openDir"), 'Open Dir', 'Fail to load the default bundle')
def test_fallback_withoutError(self):
str_bundle = StringBundle.get_bundle('zh-TW')
self.assertEqual(str_bundle.get_string("openDir"), u'\u958B\u555F\u76EE\u9304', 'Fail to load the zh-TW bundle')
def test_setInvaleLocaleToEnv_printErrorMsg(self):
prev_lc = os.environ['LC_ALL']
prev_lang = os.environ['LANG']
os.environ['LC_ALL'] = 'UTF-8'
os.environ['LANG'] = 'UTF-8'
str_bundle = StringBundle.get_bundle()
self.assertEqual(str_bundle.get_string("openDir"), 'Open Dir', 'Fail to load the default bundle')
os.environ['LC_ALL'] = prev_lc
os.environ['LANG'] = prev_lang
if __name__ == '__main__':
unittest.main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。