예제 #1
0
class _TestLua_GetText_SingleFile(unittest.TestCase):
    filename = 'test.lua'

    def setUp(self):
        self.p = Lua_GetText()

    def run_test(self):
        self.p.parse(self.code, self.filename)

        # Make sure we didn't find anything more then expected
        self.assertEqual(self.items.keys(), self.p.translatable_items.keys())

        # for msgids in sorted(self.items.keys()):
        for msgid in self.items.keys():
            golden_list, found_list = self.items[
                msgid], self.p.translatable_items[msgid]
            self.assertEqual(len(golden_list), len(found_list))
            for i in range(0, len(found_list)):
                golden_item, found_item = golden_list[i], found_list[i]
                # We only compare the keys in 'golden_item', 'found_item' may contain
                # more keys that we do not care for.
                for key in golden_item.keys():
                    self.assertEqual(golden_item[key], found_item[key])
예제 #2
0
 def setUp(self):
     self.p = Lua_GetText()