def testHelp(self): test_input = ['-h'] # main(test_input) if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertFalse(output) with capture_stdout(main, test_input) as output: self.assertTrue("optional arguments" in output)
def testNoneFloatVib(self): test_input = ["-l", TPA_LIST, "-d", SUB_DATA_DIR, "-t", "-v", "ghost"] # main(test_input) if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("not convert string" in output) with capture_stdout(main, test_input) as output: self.assertTrue("optional arguments" in output)
def testMisMatchStoich(self): test_input = ["-l", FILE_LIST_MISMATCH_STOICH] try: main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("Check stoichiometries" in output) finally: silent_remove(GOODVIBES_CSV, disable=DISABLE_REMOVE) pass
def testTPA(self): # check handles it when not all atoms in are in all molecules # also checks saving GoodVibes output together test_input = ["-l", TPA_LIST, "-d", SUB_DATA_DIR, "-t", "-f", "100"] try: main(test_input) self.assertFalse(diff_lines(TPA_OUT, GOOD_TPA_OUT)) finally: silent_remove(TPA_OUT, disable=DISABLE_REMOVE) silent_remove(TPA_VIBES_OUT, disable=DISABLE_REMOVE) pass
def testTPAAltVib(self): test_input = [ "-l", TPA_LIST, "-d", SUB_DATA_DIR, "-t", "-v", "0.984", "-f", "100" ] try: main(test_input) self.assertFalse(diff_lines(TPA_OUT, GOOD_TPA_SCALED_OUT)) finally: silent_remove(TPA_OUT, disable=DISABLE_REMOVE) silent_remove(TPA_VIBES_OUT, disable=DISABLE_REMOVE) pass
def testMoleculeWithOneFreq(self): test_input = [ "-l", LIST_W_CO, "-d", SUB_DATA_DIR, "-o", "aea_prod.csv", "-t", "-ti", "688.15,888.15,25", "--temp", "788.15", "-f", "0", "-v", "1.0" ] try: main(test_input) self.assertFalse(diff_lines(PROD_OUT, GOOD_CO_PROD_OUT)) finally: silent_remove(PROD_OUT, disable=DISABLE_REMOVE) silent_remove(AEA_PROD_VIBES_OUT, disable=DISABLE_REMOVE) pass
def testTi(self): # check handles it when not all atoms in are in all molecules # also checks saving GoodVibes output together test_input = ["-l", TI_LIST, "-d", SUB_DATA_DIR, "-t", "-o", AE_OUT] silent_remove(AEA_VIBES_OUT) try: main(test_input) self.assertFalse(diff_lines(AE_OUT, GOOD_AE_TI_OUT)) self.assertTrue(os.path.exists(AEA_VIBES_OUT)) finally: silent_remove(AE_OUT, disable=DISABLE_REMOVE) silent_remove(AEA_VIBES_OUT, disable=DISABLE_REMOVE) pass
def testReactProd(self): # check handles it when not all atom types in are in all molecules # also checks saving GoodVibes output together test_input = [ "-l", PROD_NO_TS_LIST, "-d", SUB_DATA_DIR, "-o", "aea_prod.csv", "-ti", "300.15,600.15,25", "--temp", "500.15", "-t", "-f", "100" ] try: main(test_input) self.assertFalse(diff_lines(PROD_OUT, GOOD_PROD_NO_TS_OUT)) finally: silent_remove(AEA_PROD_VIBES_OUT, disable=DISABLE_REMOVE) silent_remove(PROD_OUT, disable=DISABLE_REMOVE) pass
def testTwoUni(self): test_input = [ "-l", FILE_LIST, "-d", TEMP_DIR, "-q", "-o", AE_OUT_BASE_NAME, "-f", "100" ] try: silent_remove(TEMP_DIR, dir_with_files=True) main(test_input) self.assertFalse(diff_lines(AE_OUT_SUB_DIR, GOOD_AE_OUT)) finally: silent_remove(TEMP_DIR, disable=DISABLE_REMOVE, dir_with_files=True) pass
def testBimolecular(self): # checks a bimolecular reaction and also saving GoodVibes output for each file test_input = [ "-l", BI_LIST, "-d", SUB_DATA_DIR, "-s", "-o", AE_OUT, "-f", "100" ] # make sure files not left from a previous run for fname in [BI_VIBES_OUT1, BI_VIBES_OUT2, BI_VIBES_OUT3]: silent_remove(fname) try: main(test_input) self.assertFalse(diff_lines(AE_OUT, GOOD_AE_BI_OUT)) for fname in [BI_VIBES_OUT1, BI_VIBES_OUT2, BI_VIBES_OUT3]: self.assertTrue(os.path.exists(fname)) finally: for fname in [BI_VIBES_OUT1, BI_VIBES_OUT2, BI_VIBES_OUT3]: silent_remove(fname, disable=DISABLE_REMOVE) silent_remove(AE_OUT, disable=DISABLE_REMOVE) pass
def testPlot(self): # check handles it when not all atoms in are in all molecules # also checks saving GoodVibes output together plot_list = [PLOT1, PLOT2, PLOT3, PLOT4] for fname in plot_list: silent_remove(fname) test_input = [ "-l", PLOT_LIST, "-d", SUB_DATA_DIR, "-p", "-pl", "pdc2,ipa", "-o", AE_OUT, "-ti", "400,500,25", "--temp", "500", "-q", "-f", "100" ] try: main(test_input) for fname in plot_list: self.assertTrue(os.path.exists(fname)) finally: silent_remove(AE_OUT, disable=DISABLE_REMOVE) for fname in plot_list: silent_remove(fname) pass