def runTest(self): """ Insert a line in a file without sentinels of a file derived of a file with sentinels, and make sure that this line is inserted in the proper place. """ # First, produce the sentinel free output. sentinel.main(self.configfilename, "push") # Verify this first step. assert os.path.exists(self.output_filename) assert file(self.output_filename).readlines() == sentinel.push_filter_lines(self.lines)[0] # get the sources back. sentinel.main(self.configfilename, "pull") # Now check that the source has not been changed. assert file(self.input_filename).readlines() == self.lines
def runTest(self): """ Insert a line in a file without sentinels of a file derived of a file with sentinels, and make sure that this line is inserted in the proper place. """ # First, produce the sentinel free output. sentinel.main(self.configfilename, "push") # Verify this first step. assert os.path.exists(self.output_filename) assert file( self.output_filename).readlines() == sentinel.push_filter_lines( self.lines)[0] # get the sources back. sentinel.main(self.configfilename, "pull") # Now check that the source has not been changed. assert file(self.input_filename).readlines() == self.lines
def runTest(self): """ Insert a line in a file without sentinels of a file derived of a file with sentinels, and make sure that this line is inserted in the proper place. """ # First, produce the sentinel free output. sentinel.main(self.configfilename, "push") # Verify this first step. assert os.path.exists(self.output_filename) assert file(self.output_filename).readlines() == self.lines # then insert one line in the sentinel free output. lines = self.lines lines[2:2] = ["This is an inserted line\n"] outfile = file(self.output_filename, "w") for line in lines: outfile.write(line) outfile.close() # get the sources back. sentinel.main(self.configfilename, "pull") # re-generate the output. sentinel.main(self.configfilename, "push") # and check for equality. assert file(self.output_filename).readlines() == lines
def runTest(self): """ Insert a line in a file without sentinels of a file derived of a file with sentinels, and make sure that this line is inserted in the proper place. """ # First, produce the sentinel free output. sentinel.main(self.configfilename, "push") # Verify this first step. assert os.path.exists(self.output_filename) filtered_lines = sentinel.push_filter_lines(self.lines)[0] assert file(self.output_filename).readlines() == filtered_lines # then insert one line in the sentinel free output. filtered_lines[1:3] = [ "These lines should be totally different\n", "and be replaced across sentinel blocks,\n", ] outfile = file(self.output_filename, "w") for line in filtered_lines: outfile.write(line) outfile.close() # get the sources back. sentinel.main(self.configfilename, "pull") # re-generate the output. sentinel.main(self.configfilename, "push") # and check for equality. assert file(self.output_filename).readlines() == filtered_lines
def runTest(self): """ Insert a line in a file without sentinels of a file derived of a file with sentinels, and make sure that this line is inserted in the proper place. """ # First, produce the sentinel free output. sentinel.main(self.configfilename, "push") # Verify this first step. assert os.path.exists(self.output_filename) assert file(self.output_filename).readlines() == self.lines # then insert two lines in the sentinel free output. lines = self.lines lines[7:9] = [ " single_class represents a (condition, register) => (expression_number, linenumber) mapping.\n", #7 " set_class represents a set of (condition, register) => (expression_number, linenumber) mappings.\n", #8 ] outfile = file(self.output_filename, "w") for line in lines: outfile.write(line) outfile.close() # get the sources back. sentinel.main(self.configfilename, "pull") # re-generate the output. sentinel.main(self.configfilename, "push") # and check for equality. assert file(self.output_filename).readlines() == lines
def runTest(self): """ Insert a line in a file without sentinels of a file derived of a file with sentinels, and make sure that this line is inserted in the proper place. """ # First, produce the sentinel free output. sentinel.main(self.configfilename, "push") # Verify this first step. assert os.path.exists(self.output_filename) filtered_lines = sentinel.push_filter_lines(self.lines)[0] assert file(self.output_filename).readlines() == filtered_lines # then insert one line in the sentinel free output. filtered_lines [1:3] = [ "These lines should be totally different\n", "and be replaced across sentinel blocks,\n", ] outfile = file(self.output_filename, "w") for line in filtered_lines: outfile.write(line) outfile.close() # get the sources back. sentinel.main(self.configfilename, "pull") # re-generate the output. sentinel.main(self.configfilename, "push") # and check for equality. assert file(self.output_filename).readlines() == filtered_lines
def runTest(self): """ Insert a line in a file without sentinels of a file derived of a file with sentinels, and make sure that this line is inserted in the proper place. """ # First, produce the sentinel free output. sentinel.main(self.configfilename, "push") # Verify this first step. assert os.path.exists(self.output_filename) assert file(self.output_filename).readlines() == self.lines # then insert two lines in the sentinel free output. lines = self.lines lines[7:9] = [" single_class represents a (condition, register) => (expression_number, linenumber) mapping.\n", #7 " set_class represents a set of (condition, register) => (expression_number, linenumber) mappings.\n", #8 ] outfile = file(self.output_filename, "w") for line in lines: outfile.write(line) outfile.close() # get the sources back. sentinel.main(self.configfilename, "pull") # re-generate the output. sentinel.main(self.configfilename, "push") # and check for equality. assert file(self.output_filename).readlines() == lines
import sys from sentinel import main if __name__ == '__main__': main(sys.argv)