def testHelp(self): test_input = ['-h'] 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 testNTripleBond(self): test_input = ["-c", N_TRIPLE_BOND_INI] try: main(test_input) self.assertFalse(diff_lines(CP_N_OUT, GOOD_CP_N_OUT)) self.assertFalse(diff_lines(F2_N_OUT, GOOD_F2_N_OUT)) finally: silent_remove(CP_N_OUT, disable=DISABLE_REMOVE) silent_remove(F2_N_OUT, disable=DISABLE_REMOVE) pass
def testSepMolecules(self): # to help when there is a reactant or product complex that is two different molecules; ignores the # larger distance between the atoms belonging to two different molecules test_input = ["-c", IGNORE_MAX_INI] try: main(test_input) self.assertFalse(diff_lines(CP_TPA_OUT, GOOD_CP_TPA_OUT)) self.assertFalse(diff_lines(F2_TPA_OUT, GOOD_F2_TPA_OUT)) finally: silent_remove(CP_TPA_OUT, disable=DISABLE_REMOVE) silent_remove(F2_TPA_OUT, disable=DISABLE_REMOVE) pass
def testMetalBond(self): # Uses a longer bond cut-off when one of the atoms is a metal test_input = ["-c", METAL_BOND_INI] try: main(test_input) self.assertFalse(diff_lines(CP_METAL_OUT, GOOD_CP_METAL_OUT)) self.assertFalse(diff_lines(F1_METAL_OUT, GOOD_F1_METAL_OUT)) self.assertFalse(diff_lines(F2_METAL_OUT, GOOD_F2_METAL_OUT)) finally: silent_remove(CP_METAL_OUT, disable=DISABLE_REMOVE) silent_remove(F1_METAL_OUT, disable=DISABLE_REMOVE) silent_remove(F2_METAL_OUT, disable=DISABLE_REMOVE) pass
def testNTripleBondSubDir(self): # Test that output files were created in subdir test_input = ["-c", N_TRIPLE_BOND_SUB_DIR_INI] try: silent_remove(TEMP_DIR, dir_with_files=True) main(test_input) self.assertFalse(diff_lines(CP_N_OUT_SUB_DIR, GOOD_CP_N_OUT)) self.assertFalse(diff_lines(F2_N_OUT_SUB_DIR, GOOD_F2_N_OUT)) finally: silent_remove(TEMP_DIR, disable=DISABLE_REMOVE, dir_with_files=True) pass
def testDubO(self): test_input = ["-c", DIMER_INI] try: main(test_input) self.assertFalse(diff_lines(CP_DI_18_24_OUT, GOOD_CP_DI_18_24_OUT)) self.assertFalse(diff_lines(F2_DI_18_24_OUT, GOOD_F2_DI_18_24_OUT)) self.assertFalse(diff_lines(CP_DI_18_16_OUT, GOOD_CP_DI_18_16_OUT)) self.assertFalse(diff_lines(F1_DI_18_16_OUT, GOOD_F1_DI_18_16_OUT)) self.assertFalse(diff_lines(F2_DI_18_16_OUT, GOOD_F2_DI_18_16_OUT)) finally: silent_remove(CP_DI_18_24_OUT, disable=DISABLE_REMOVE) silent_remove(F2_DI_18_24_OUT, disable=DISABLE_REMOVE) silent_remove(CP_DI_18_16_OUT, disable=DISABLE_REMOVE) silent_remove(F1_DI_18_16_OUT, disable=DISABLE_REMOVE) silent_remove(F2_DI_18_16_OUT, disable=DISABLE_REMOVE) pass
def testCPFooter(self): # Checks adding a multiline footer # Also checks making the output directory the current directory using 'output_directory =' in the ini test_input = ["-c", ADD_CP_FOOTER_INI] try: main(test_input) self.assertFalse( diff_lines(CP_FOOTER_CP_OUT, GOOD_CP_FOOTER_CP_OUT)) self.assertFalse( diff_lines(CP_FOOTER_F1_OUT, GOOD_CP_FOOTER_F1_OUT)) self.assertFalse( diff_lines(CP_FOOTER_F2_OUT, GOOD_CP_FOOTER_F2_OUT)) finally: silent_remove(CP_FOOTER_CP_OUT, disable=DISABLE_REMOVE) silent_remove(CP_FOOTER_F1_OUT, disable=DISABLE_REMOVE) silent_remove(CP_FOOTER_F2_OUT, disable=DISABLE_REMOVE) pass
def testLonelyFragments(self): test_input = ["-c", LONELY_INI] try: main(test_input) self.assertFalse(diff_lines(CP_20_21_OUT, GOOD_CP_20_21_OUT)) self.assertFalse(diff_lines(CP_22_23_OUT, GOOD_CP_22_23_OUT)) self.assertFalse(diff_lines(CP_24_18_OUT, GOOD_CP_24_18_OUT)) self.assertFalse(diff_lines(F2_20_21_OUT, GOOD_F2_20_21_OUT)) self.assertFalse(diff_lines(F2_22_23_OUT, GOOD_F2_22_23_OUT)) self.assertFalse(diff_lines(F2_24_18_OUT, GOOD_F2_24_18_OUT)) finally: silent_remove(CP_20_21_OUT, disable=DISABLE_REMOVE) silent_remove(CP_22_23_OUT, disable=DISABLE_REMOVE) silent_remove(CP_24_18_OUT, disable=DISABLE_REMOVE) silent_remove(F2_20_21_OUT, disable=DISABLE_REMOVE) silent_remove(F2_22_23_OUT, disable=DISABLE_REMOVE) silent_remove(F2_24_18_OUT, disable=DISABLE_REMOVE) pass
def testDefIni(self): test_input = ["-c", DEF_INI] try: main(test_input) self.assertFalse(diff_lines(CP_15_14_OUT, GOOD_CP_15_14_OUT)) self.assertFalse(diff_lines(CP_14_15_OUT, GOOD_CP_14_15_OUT)) self.assertFalse(diff_lines(F1_14_15_OUT, GOOD_F1_14_15_OUT)) self.assertFalse(diff_lines(F2_14_15_OUT, GOOD_F2_14_15_OUT)) self.assertEqual(len(diff_lines(F1_15_14_OUT, GOOD_F1_14_15_OUT)), 2) self.assertEqual(len(diff_lines(F2_15_14_OUT, GOOD_F2_14_15_OUT)), 2) finally: silent_remove(CP_15_14_OUT, disable=DISABLE_REMOVE) silent_remove(CP_14_15_OUT, disable=DISABLE_REMOVE) silent_remove(F1_14_15_OUT, disable=DISABLE_REMOVE) silent_remove(F2_14_15_OUT, disable=DISABLE_REMOVE) silent_remove(F1_15_14_OUT, disable=DISABLE_REMOVE) silent_remove(F2_15_14_OUT, disable=DISABLE_REMOVE) pass
def testDubCC(self): test_input = ["-c", CC_INI] try: main(test_input) self.assertFalse(diff_lines(CP_CC_12_11_OUT, GOOD_CP_CC_12_11_OUT)) self.assertFalse(diff_lines(F1_CC_12_11_OUT, GOOD_F1_CC_12_11_OUT)) self.assertFalse(diff_lines(F2_CC_12_11_OUT, GOOD_F2_CC_12_11_OUT)) self.assertFalse(diff_lines(CP_CC_12_38_OUT, GOOD_CP_CC_12_38_OUT)) self.assertFalse(diff_lines(F2_CC_12_38_OUT, GOOD_F2_CC_12_38_OUT)) self.assertFalse(diff_lines(CP_CC_13_12_OUT, GOOD_CP_CC_13_12_OUT)) self.assertFalse(diff_lines(F1_CC_13_12_OUT, GOOD_F1_CC_13_12_OUT)) self.assertFalse(diff_lines(F2_CC_13_12_OUT, GOOD_F2_CC_13_12_OUT)) finally: silent_remove(CP_CC_12_11_OUT, disable=DISABLE_REMOVE) silent_remove(F1_CC_12_11_OUT, disable=DISABLE_REMOVE) silent_remove(F2_CC_12_11_OUT, disable=DISABLE_REMOVE) silent_remove(CP_CC_12_38_OUT, disable=DISABLE_REMOVE) silent_remove(F2_CC_12_38_OUT, disable=DISABLE_REMOVE) silent_remove(CP_CC_13_12_OUT, disable=DISABLE_REMOVE) silent_remove(F1_CC_13_12_OUT, disable=DISABLE_REMOVE) silent_remove(F2_CC_13_12_OUT, disable=DISABLE_REMOVE) pass
def testMissingFile(self): test_input = ['-c', MISSING_FILE_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("No such file or directory" in output)