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")
示例#2
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')
 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"), "???")
示例#4
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'), '???')