You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
709 B

  1. '''
  2. Created on Jan 25, 2014
  3. @author: Chris
  4. '''
  5. import unittest
  6. import i18n
  7. # from i18n import I18N
  8. #
  9. class Test(unittest.TestCase):
  10. def test_i18n_loads_module_by_name(self):
  11. self.assertTrue(i18n._DICTIONARY is None)
  12. i18n.load('english')
  13. self.assertTrue(i18n._DICTIONARY is not None)
  14. self.assertEqual('Cancel', i18n.translate('cancel'))
  15. i18n.load('french')
  16. self.assertEqual('Annuler', i18n.translate('cancel'))
  17. def test_i18n_throws_exception_on_no_lang_file_found(self):
  18. self.assertRaises(IOError, i18n.load, 'chionenglish')
  19. if __name__ == "__main__":
  20. pass
  21. #import sys;sys.argv = ['', 'Test.testName']
  22. unittest.main()