def test_without_locale(self): tools.generate(self.src_path, self.dst_path) f1_dst_path = os.path.join(self.dst_path, os.path.basename(self.f1.name)) f2_dst_path = os.path.join(self.dst_path, os.path.basename(self.f2.name)) self.assertTrue(os.path.exists(f1_dst_path)) self.assertFalse(os.path.exists(f2_dst_path)) self.assertEqual("Hello World!", open(f1_dst_path).read())
def test_with_locale(self): po_path = os.path.join(self.src_path, "fr.po") mo_path = os.path.join(self.src_path, "fr.mo") with open(po_path, "w") as tmp: tmp.write("""msgid "Hello World!" msgstr "Bonjour tout le monde !" """) tools.generate(self.src_path, self.dst_path, "fr") self.assertTrue(os.path.exists(mo_path)) f1_dst_path = os.path.join(self.dst_path, os.path.basename(self.f1.name)) f2_dst_path = os.path.join(self.dst_path, os.path.basename(self.f2.name)) self.assertTrue(os.path.exists(f1_dst_path)) self.assertFalse(os.path.exists(f2_dst_path)) self.assertEqual("Bonjour tout le monde !", open(f1_dst_path).read())