def main(argv=None): # pragma: no cover if argv is None: argv = sys.argv try: opts, args = getopt.getopt(argv[1:], "ho:v", ["help", "output="]) except getopt.error as msg: info(sys.argv[0].split("/")[-1] + ": " + str(msg) + "\n\t for help use --help") return -1 # Test for correct number of arguments prog_name = os.path.basename(sys.argv[0]) if len(args) == 6: [csv1, csv2, abs_diff_file, rel_diff_file, err_file, csvsummary] = args else: info('%s: incorrect operands: Try %s -h for more info' % (prog_name, prog_name)) return -1 if csv1[-4:] != '.csv' or csv1[-7:] == 'Map.csv' or csv1[ -9:] == 'Table.csv' or csv1[-10:] == 'Screen.csv': info('%s: input file <%s> with improper extension' % (prog_name, csv1)) return -1 if csv2[-4:] != '.csv' or csv2[-7:] == 'Map.csv' or csv2[ -9:] == 'Table.csv' or csv2[-10:] == 'Screen.csv': info('%s: input file <%s> with improper extension' % (prog_name, csv2)) return -1 # Load diffing threshold dictionary thresh_dict = ThreshDict(os.path.join(script_dir, 'math_diff.config')) math_diff(thresh_dict, csv1, csv2, abs_diff_file, rel_diff_file, err_file, csvsummary) return 0
def main(argv=None): # pragma: no cover if argv is None: argv = sys.argv try: opts, args = getopt.getopt(argv[1:], "ho:v", ["help", "output="]) except getopt.error as msg: print(sys.argv[0].split("/")[-1] + ": " + str(msg) + "\n\t for help use --help") return -1 # Test for correct number of arguments # prog_name = os.path.basename(sys.argv[0]) # if len(args) == 5: [ inputfile1, inputfile2, abs_diff_file, rel_diff_file, err_file, summary_file ] = args # else: # info('%s: incorrect operands: Try %s -h for more info' % (prog_name, prog_name)) # return -1 # Load diffing threshold dictionary thresh_dict = ThreshDict(os.path.join(script_dir, 'math_diff.config')) # run the main program. table_diff(thresh_dict, inputfile1, inputfile2, abs_diff_file, rel_diff_file, err_file, summary_file) return 0
def setUp(self): self.cur_dir_path = os.path.dirname(os.path.realpath(__file__)) self.diff_files_dir = os.path.join(self.cur_dir_path, 'tbl_resources') self.temp_output_dir = tempfile.mkdtemp() self.thresh_dict = ThreshDict(os.path.join(self.diff_files_dir, 'test_table_diff.config'))
def test_construction(self): thresh_file = tempfile.mkstemp(suffix='.config')[1] with open(thresh_file, 'w') as f_thresh: f_thresh.write(self.typical_thresholds) t = ThreshDict(thresh_file) self.assertEqual(16, len(t.thresholds))