コード例 #1
0
ファイル: test_pomerge.py プロジェクト: slide333333/translate
 def test_mergesore_bad_data(self):
     """Test that we catch bad options sent to mergestore"""
     templatefile = BytesIO(b"")
     inputfile = BytesIO(b"")
     outputfile = BytesIO()
     with pytest.raises(ValueError):
         pomerge.mergestore(inputfile, outputfile, templatefile, mergeblanks="yay")
     with pytest.raises(ValueError):
         pomerge.mergestore(inputfile, outputfile, templatefile, mergecomments="yay")
コード例 #2
0
ファイル: test_pomerge.py プロジェクト: diorcety/translate
 def test_mergesore_bad_data(self):
     """Test that we catch bad options sent to mergestore"""
     templatefile = wStringIO.StringIO("")
     inputfile = wStringIO.StringIO("")
     outputfile = wStringIO.StringIO()
     with pytest.raises(ValueError):
         pomerge.mergestore(inputfile, outputfile, templatefile, mergeblanks="yay")
     with pytest.raises(ValueError):
         pomerge.mergestore(inputfile, outputfile, templatefile, mergecomments="yay")
コード例 #3
0
ファイル: test_pomerge.py プロジェクト: slide333333/translate
 def mergexliff(
     self,
     templatesource,
     inputsource,
     mergeblanks="yes",
     mergefuzzy="yes",
     mergecomments="yes",
 ):
     """merges the sources of the given files and returns a new xlifffile object"""
     templatefile = BytesIO(templatesource.encode())
     inputfile = BytesIO(inputsource.encode())
     outputfile = BytesIO()
     assert pomerge.mergestore(
         inputfile,
         outputfile,
         templatefile,
         mergeblanks=mergeblanks,
         mergefuzzy=mergefuzzy,
         mergecomments=mergecomments,
     )
     outputxliffstring = outputfile.getvalue()
     print("Generated XML:")
     print(outputxliffstring)
     outputxlifffile = xliff.xlifffile(outputxliffstring)
     return outputxlifffile
コード例 #4
0
ファイル: test_pomerge.py プロジェクト: mozilla/markup-lib
 def mergestore(self, templatesource, inputsource):
     """merges the sources of the given files and returns a new pofile object"""
     templatefile = wStringIO.StringIO(templatesource)
     inputfile = wStringIO.StringIO(inputsource)
     outputfile = wStringIO.StringIO()
     assert pomerge.mergestore(inputfile, outputfile, templatefile)
     outputpostring = outputfile.getvalue()
     outputpofile = po.pofile(outputpostring)
     return outputpofile
コード例 #5
0
ファイル: test_pomerge.py プロジェクト: mozilla/markup-lib
 def mergexliff(self, templatesource, inputsource):
     """merges the sources of the given files and returns a new xlifffile object"""
     templatefile = wStringIO.StringIO(templatesource)
     inputfile = wStringIO.StringIO(inputsource)
     outputfile = wStringIO.StringIO()
     assert pomerge.mergestore(inputfile, outputfile, templatefile)
     outputxliffstring = outputfile.getvalue()
     print "Generated XML:"
     print outputxliffstring
     outputxlifffile = xliff.xlifffile(outputxliffstring)
     return outputxlifffile
コード例 #6
0
ファイル: test_pomerge.py プロジェクト: alghaamdi/translate
 def mergestore(self, templatesource, inputsource, mergeblanks="yes",
                mergefuzzy="yes",
                mergecomments="yes"):
     """merges the sources of the given files and returns a new pofile
     object"""
     templatefile = wStringIO.StringIO(templatesource)
     inputfile = wStringIO.StringIO(inputsource)
     outputfile = wStringIO.StringIO()
     assert pomerge.mergestore(inputfile, outputfile, templatefile,
                               mergeblanks=mergeblanks,
                               mergefuzzy=mergefuzzy,
                               mergecomments=mergecomments,)
     outputpostring = outputfile.getvalue()
     outputpofile = po.pofile(outputpostring)
     return outputpofile
コード例 #7
0
 def mergestore(self, templatesource, inputsource, mergeblanks="yes",
                mergefuzzy="yes",
                mergecomments="yes"):
     """merges the sources of the given files and returns a new pofile
     object"""
     templatefile = wStringIO.StringIO(templatesource)
     inputfile = wStringIO.StringIO(inputsource)
     outputfile = wStringIO.StringIO()
     assert pomerge.mergestore(inputfile, outputfile, templatefile,
                               mergeblanks=mergeblanks,
                               mergefuzzy=mergefuzzy,
                               mergecomments=mergecomments,)
     outputpostring = outputfile.getvalue()
     outputpofile = po.pofile(outputpostring)
     return outputpofile
コード例 #8
0
ファイル: test_pomerge.py プロジェクト: onia/translate
 def mergexliff(self, templatesource, inputsource, mergeblanks="yes",
                mergefuzzy="yes",
                mergecomments="yes"):
     """merges the sources of the given files and returns a new xlifffile
     object"""
     templatefile = wStringIO.StringIO(templatesource)
     inputfile = wStringIO.StringIO(inputsource)
     outputfile = wStringIO.StringIO()
     assert pomerge.mergestore(inputfile, outputfile, templatefile,
                               mergeblanks=mergeblanks,
                               mergefuzzy=mergefuzzy,
                               mergecomments=mergecomments)
     outputxliffstring = outputfile.getvalue()
     print("Generated XML:")
     print(outputxliffstring)
     outputxlifffile = xliff.xlifffile(outputxliffstring)
     return outputxlifffile