Exemple #1
0
 def test_simple(self):
     merge_files(os.path.join(TEST_PATH, "test_files", "merged.txt"),
                [os.path.join(TEST_PATH, "test_files", "f1"),
                 os.path.join(TEST_PATH, "test_files", "f2"),
                 os.path.join(TEST_PATH, "test_files", "f3")], ["+ ","- ", "~ "])
     with open(os.path.join(TEST_PATH, "test_files", "merged.txt")) as f:
         self.assertEqual(f.read().strip(), "+ 1a\n- 2a\n~ 3a\n\n+ 1b\n- 2b\n~ 3b\n\n+ \n- 2c\n~ 3c\n\n+ 1c\n- 2d")
Exemple #2
0
 def test_simple(self):
     merge_files(os.path.join(TEST_PATH, "test_files", "merged.txt"), [
         os.path.join(TEST_PATH, "test_files", "f1"),
         os.path.join(TEST_PATH, "test_files", "f2"),
         os.path.join(TEST_PATH, "test_files", "f3")
     ], ["+ ", "- ", "~ "])
     with open(os.path.join(TEST_PATH, "test_files", "merged.txt")) as f:
         self.assertEqual(
             f.read().strip(),
             "+ 1a\n- 2a\n~ 3a\n\n+ 1b\n- 2b\n~ 3b\n\n+ \n- 2c\n~ 3c\n\n+ 1c\n- 2d"
         )
Exemple #3
0
def merge_translations(args):
    annotation_list = [
        '- ', '+ ', '~ ', '> ', '= ', '* ', '# ', '$ ', '^ ', '% ', '& ', '@ '
    ]
    merge_files(args.t_output_file, args.t_input_files, annotation_list)
def merge_translations(args):
    annotation_list = ['- ', '+ ', '~ ', '> ', '= ', '* ', '# ', '$ ', '^ ', '% ', '& ', '@ ']
    merge_files(args.t_output_file, args.t_input_files, annotation_list)
Exemple #5
0
 def test_bad_file(self):
     with self.assertRaises(Exception):
         merge_files(os.path.join(TEST_PATH, "temp_files", "merged.txt"),
                     [os.path.join(TEST_PATH, "test_files", "fdafda1")],
                     ["+ "])
Exemple #6
0
 def test_annotation_failure(self):
     with self.assertRaises(Exception):
         merge_files(os.path.join(TEST_PATH, "temp_files", "merged.txt"), [
             os.path.join(TEST_PATH, "test_files", "f1"),
             os.path.join(TEST_PATH, "test_files", "f2")
         ], ["+ "])
Exemple #7
0
 def test_empty(self):
     merge_files(os.path.join(TEST_PATH, "temp_files", "merged.txt"),
                 [os.path.join(TEST_PATH, "test_files", "empty.txt")],
                 ["+ "])
     with open(os.path.join(TEST_PATH, "temp_files", "merged.txt")) as f:
         self.assertEqual(f.read().strip(), "")
Exemple #8
0
 def test_bad_file(self):
     with self.assertRaises(Exception):
         merge_files(os.path.join(TEST_PATH, "temp_files", "merged.txt"),
                    [os.path.join(TEST_PATH, "test_files", "fdafda1")], ["+ "])
Exemple #9
0
 def test_annotation_failure(self):
     with self.assertRaises(Exception):
         merge_files(os.path.join(TEST_PATH, "temp_files", "merged.txt"),
                    [os.path.join(TEST_PATH, "test_files", "f1"),
                     os.path.join(TEST_PATH, "test_files", "f2")], ["+ "])
Exemple #10
0
 def test_empty(self):
     merge_files(os.path.join(TEST_PATH, "temp_files", "merged.txt"),
                [os.path.join(TEST_PATH, "test_files", "empty.txt")], ["+ "])
     with open(os.path.join(TEST_PATH, "temp_files", "merged.txt")) as f:
         self.assertEqual(f.read().strip(), "")