1 Star 0 Fork 0

GAN/labelImg

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
test_stringBundle.py 1.00 KB
一键复制 编辑 原始数据 按行查看 历史
tzutalin 提交于 2018-12-29 02:07 +08:00 . fix the crash when providing invalid locale in env
import os
import sys
import unittest
from stringBundle import StringBundle
class TestStringBundle(unittest.TestCase):
def test_loadDefaultBundle_withoutError(self):
strBundle = StringBundle.getBundle('en')
self.assertEqual(strBundle.getString("openDir"), 'Open Dir', 'Fail to load the default bundle')
def test_fallback_withoutError(self):
strBundle = StringBundle.getBundle('zh-TW')
self.assertEqual(strBundle.getString("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'
strBundle = StringBundle.getBundle()
self.assertEqual(strBundle.getString("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()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/githubGAN/labelImg.git
git@gitee.com:githubGAN/labelImg.git
githubGAN
labelImg
labelImg
master

搜索帮助