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")
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")
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
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
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
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
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