コード例 #1
0
ファイル: test_utils.py プロジェクト: MarkTseng/docs-tools
 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")
コード例 #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"
         )
コード例 #3
0
def merge_translations(args):
    annotation_list = [
        '- ', '+ ', '~ ', '> ', '= ', '* ', '# ', '$ ', '^ ', '% ', '& ', '@ '
    ]
    merge_files(args.t_output_file, args.t_input_files, annotation_list)
コード例 #4
0
ファイル: translate.py プロジェクト: judahschvimer/docs-tools
def merge_translations(args):
    annotation_list = ['- ', '+ ', '~ ', '> ', '= ', '* ', '# ', '$ ', '^ ', '% ', '& ', '@ ']
    merge_files(args.t_output_file, args.t_input_files, annotation_list)
コード例 #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")],
                     ["+ "])
コード例 #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")
         ], ["+ "])
コード例 #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(), "")
コード例 #8
0
ファイル: test_utils.py プロジェクト: MarkTseng/docs-tools
 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")], ["+ "])
コード例 #9
0
ファイル: test_utils.py プロジェクト: MarkTseng/docs-tools
 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")], ["+ "])
コード例 #10
0
ファイル: test_utils.py プロジェクト: MarkTseng/docs-tools
 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(), "")