def test_language_manager_add(self):
     lang_manager = NyLanguages()
     count0 = len(lang_manager.langs)
     lang_manager.add_language("en-pt", "Pirate English")
     self.assertEqual(lang_manager.get_language_name("en-pt"), "Pirate English")
     self.assertEqual(len(lang_manager.langs), count0 + 1)
     # one more time
     self.assertRaises(KeyError, lang_manager.add_language, "en-pt", "One More")
     self.assertEqual(lang_manager.get_language_name("en-pt"), "Pirate English")
Esempio n. 2
0
 def test_language_manager_del(self):
     lang_manager = NyLanguages()
     lang_manager.add_language('en-pt', 'Pirate English')
     count0 = len(lang_manager.langs)
     lang_manager.del_language('en-PT')
     # One more time
     self.assertRaises(KeyError, lang_manager.del_language, 'en-PT')
     self.assertEqual(len(lang_manager.langs), count0 - 1)
     self.assertEqual(lang_manager.get_language_name('en-PT'), '???')
 def test_language_manager_del(self):
     lang_manager = NyLanguages()
     lang_manager.add_language("en-pt", "Pirate English")
     count0 = len(lang_manager.langs)
     lang_manager.del_language("en-PT")
     # One more time
     self.assertRaises(KeyError, lang_manager.del_language, "en-PT")
     self.assertEqual(len(lang_manager.langs), count0 - 1)
     self.assertEqual(lang_manager.get_language_name("en-PT"), "???")
Esempio n. 4
0
 def test_language_manager_add(self):
     lang_manager = NyLanguages()
     count0 = len(lang_manager.langs)
     lang_manager.add_language('en-pt', 'Pirate English')
     self.assertEqual(lang_manager.get_language_name('en-pt'),
                      'Pirate English')
     self.assertEqual(len(lang_manager.langs), count0 + 1)
     # one more time
     self.assertRaises(KeyError, lang_manager.add_language,
                       'en-pt', 'One More')
     self.assertEqual(lang_manager.get_language_name('en-pt'),
                      'Pirate English')
Esempio n. 5
0
 def test_language_manager_init(self):
     lang_manager = NyLanguages()
     # test languages.txt was used (we have some langs)
     self.assertTrue(len(lang_manager.langs) > 10)
     self.assertTrue(len(lang_manager.languages) > 10)