def testMissingTpl(self): test_input = ["-f", LOG_FILE, "-c"] # main(test_input) if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("No template file" in output)
def testUnknownArg(self): test_input = ['--ghost'] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("unrecognized arguments" in output) with capture_stdout(main, test_input) as output: self.assertTrue("optional arguments" in output)
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 testFragments(self): test_input = ["-t", LOW_E_TPL, "-f", FRAG_LOG_FILE] try: main(test_input) self.assertFalse(diff_lines(FRAG_COM_OUT, GOOD_FRAG_COM_OUT)) finally: silent_remove(FRAG_COM_OUT, disable=DISABLE_REMOVE) pass
def testTemplateTypeMatching(self): test_input = ["-t", TYPE_MATCH_TPL, "-f", TYPE_MATCH_LOG, "-e"] try: main(test_input) self.assertFalse(diff_lines(TYPE_MATCH_OUT, GOOD_TYPE_MATCH_OUT)) finally: silent_remove(TYPE_MATCH_OUT, disable=DISABLE_REMOVE) pass
def testLowEn(self): test_input = ["-t", LOW_E_TPL, "-f", LOG_LOW_E_FILE, "-e"] try: main(test_input) self.assertFalse(diff_lines(COM_LOW_E_OUT, GOOD_COM_LOW_E_FILE)) finally: silent_remove(COM_LOW_E_OUT, disable=DISABLE_REMOVE) pass
def testFileCPTpl(self): test_input = ["-t", CP_COM_TPL, "-f", LOG_FILE, "-c"] try: main(test_input) self.assertFalse(diff_lines(COM3_OUT, GOOD_COM3_OUT)) finally: silent_remove(COM3_OUT, disable=DISABLE_REMOVE) pass
def testSpecifyStep(self): # Check specifying a particular step's coordinates test_input = ["-t", ROUTE_ONLY_TPL, "-f", SPEC_STEP_LOG, "-s", "25"] try: silent_remove(SPEC_STEP_OUT) main(test_input) self.assertFalse(diff_lines(SPEC_STEP_OUT, GOOD_SPEC_STEP_OUT)) finally: silent_remove(SPEC_STEP_OUT, disable=DISABLE_REMOVE) pass
def testPinnedAtoms(self): test_input = [ "-t", PINNED_ATOM_TPL, "-f", PINNED_ATOM_LOG, "-o", PINNED_ATOM_OUT ] try: main(test_input) self.assertFalse(diff_lines(PINNED_ATOM_OUT, GOOD_PINNED_ATOM_OUT)) finally: silent_remove(PINNED_ATOM_OUT, disable=DISABLE_REMOVE) pass
def testAddLines(self): # Gaussian needs to have two blank lines at the end. Check adding them if they don't exist test_input = ["-t", ROUTE_ONLY_TPL, "-f", FRAG_LOG_FILE] try: main(test_input) self.assertFalse( diff_lines(ROUTE_ONLY_COM_OUT, GOOD_ROUTE_ONLY_COM_OUT)) finally: silent_remove(ROUTE_ONLY_COM_OUT, disable=DISABLE_REMOVE) pass
def testTemplateNumberMatching(self): test_input = [ "-t", TYPE_NUM_MATCH_TPL, "-f", TYPE_MATCH_LOG, "-e", "-o", "s12but_17_84_f2_t.com" ] try: main(test_input) self.assertFalse( diff_lines(TYPE_NUM_MATCH_OUT, GOOD_TYPE_NUM_MATCH_OUT)) finally: silent_remove(TYPE_NUM_MATCH_OUT, disable=DISABLE_REMOVE) pass
def testMissingFile(self): test_input = ["-t", "ghost.tpl", "-f", LOG_FILE, "-c"] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("Problems reading file" in output)