def testHO_OO_HH_OHGofR(self): try: main(["-c", HO_OO_HH_OH_GOFR_INI]) self.assertFalse( diff_lines(DEF_GOFR_OUT, GOOD_HO_OO_HH_OH_GOFR_OUT)) finally: silent_remove(DEF_GOFR_OUT, disable=DISABLE_REMOVE)
def testFindNoWatH(self): test_input = ["-c", WRONG_WAT_H_TYPE_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue(WAT_H_TYPE in output) self.assertTrue("no such atoms were found" in output)
def testOHDist2(self): try: main(["-c", OH_DIST_INI2]) # self.assertFalse(diff_lines(DEF_OUT, GOOD_OH_DIST_OUT)) finally: # silent_remove(DEF_OUT, disable=DISABLE_REMOVE) pass
def testCalcProps(self): try: test_input = ["-c", CALC_GLU_PROPS_INI, "-p"] main(test_input) self.assertFalse(diff_lines(HIJ_NEW_GLU2_OUT, GOOD_GLU_PROPS_OUT)) finally: silent_remove(HIJ_NEW_GLU2_OUT, disable=DISABLE_REMOVE)
def testOHDist(self): num = 12 print(isinstance(num, float)) try: main(["-c", OH_DIST_INI]) self.assertFalse(diff_lines(DEF_OUT, GOOD_OH_DIST_OUT)) finally: silent_remove(DEF_OUT, disable=DISABLE_REMOVE)
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 testMissingConfig(self): test_input = ["-c", INCOMP_INI_PATH] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("Missing config val" in output) with capture_stdout(main, test_input) as output: self.assertTrue("optional arguments" in output)
def testHIJArqNew(self): # Test calculating the Maupin form try: test_input = ["-c", HIJ_NEW_INI] main(test_input) self.assertFalse(diff_lines(HIJ_ARQ_OUT, GOOD_HIJ_NEW_OUT)) finally: silent_remove(HIJ_ARQ_OUT, disable=DISABLE_REMOVE)
def testMissingConfig(self): test_input = ["-c", INCOMP_INI_PATH] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("Missing config val for key 'water_o_type'" in output) with capture_stdout(main, test_input) as output: self.assertTrue("optional arguments" in output)
def testCombineCECRestrictTimesteps(self): try: test_input = ["-c", COMBINE_CEC_ONLY_STEPS_INI] main(test_input) self.assertFalse( diff_lines(COMBINE_CEC_ONLY_STEPS_OUT, GOOD_COMBINE_CEC_ONLY_STEPS_OUT)) finally: silent_remove(COMBINE_CEC_ONLY_STEPS_OUT, disable=DISABLE_REMOVE)
def testCombineCECMultifile(self): try: test_input = ["-c", COMBINE_CEC_MULTI_FILE_INI] main(test_input) self.assertFalse( diff_lines(COMBINE_CEC_MULTI_FILE_OUT, GOOD_COMBINE_CEC_MULTI_FILE_OUT)) finally: silent_remove(COMBINE_CEC_MULTI_FILE_OUT, disable=DISABLE_REMOVE)
def testHO_OO_HH_OHGofR_MaxSteps(self): test_input = ["-c", HO_OO_HH_OH_GOFR_INI_MAX_STEPS] if logger.isEnabledFor(logging.DEBUG): main(test_input) try: with capture_stdout(main, test_input) as output: self.assertTrue(good_long_out_msg in output) self.assertFalse(diff_lines(DEF_MAX_STEPS_OUT, GOOD_HO_OO_HH_OH_GOFR_OUT_MAX_STEPS)) finally: silent_remove(DEF_MAX_STEPS_OUT, disable=DISABLE_REMOVE)
def testHIJAlt(self): try: test_input = ["-c", HIJ_ALT_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("did not have the full list of atom numbers" in output) self.assertFalse(diff_lines(HIJ_ALT_OUT, GOOD_HIJ_ALT_OUT)) finally: silent_remove(HIJ_ALT_OUT, disable=DISABLE_REMOVE)
def testCombineCEC(self): try: test_input = ["-c", COMBINE_CEC_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("Did not find 'timestep' value" in output) self.assertFalse(diff_lines(COMBINE_CEC_OUT, GOOD_COMBINE_CEC_OUT)) finally: silent_remove(COMBINE_CEC_OUT, disable=DISABLE_REMOVE)
def testHIJArq(self): # Test calculating the Maupin form try: test_input = ["-c", HIJ_ARQ_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue( "did not have the full list of atom numbers" in output) self.assertFalse(diff_lines(HIJ_ARQ_OUT, GOOD_HIJ_ARQ_OUT)) finally: silent_remove(HIJ_ARQ_OUT, disable=DISABLE_REMOVE)
def testHO_OO_HH_OHGofR_MaxSteps(self): test_input = ["-c", HO_OO_HH_OH_GOFR_INI_MAX_STEPS] if logger.isEnabledFor(logging.DEBUG): main(test_input) try: with capture_stdout(main, test_input) as output: self.assertTrue(good_long_out_msg in output) self.assertFalse( diff_lines(DEF_MAX_STEPS_OUT, GOOD_HO_OO_HH_OH_GOFR_OUT_MAX_STEPS)) finally: silent_remove(DEF_MAX_STEPS_OUT, disable=DISABLE_REMOVE)
def testHIJArq6(self): # Test calculating the Maupin form try: test_input = ["-c", HIJ_ARQ6_GLU2_INI, "-p"] if logger.isEnabledFor(logging.DEBUG): main(test_input) # because i've turned off printing, there should be no output with capture_stdout(main, test_input) as output: self.assertFalse(output) self.assertFalse( diff_lines(HIJ_NEW_GLU2_OUT, GOOD_HIJ_NEW_GLU2_OUT)) finally: silent_remove(HIJ_NEW_GLU2_OUT, disable=DISABLE_REMOVE)
def testMaxTimestepsCalcWatHyd(self): try: main(["-c", WAT_HYD_INI]) self.assertFalse(diff_lines(HIJ_OUT, GOOD_WAT_HYD_OUT)) finally: silent_remove(HIJ_OUT, disable=DISABLE_REMOVE)
def testHO_OO_HH_OHGofR(self): try: main(["-c", HO_OO_HH_OH_GOFR_INI]) self.assertFalse(diff_lines(DEF_GOFR_OUT, GOOD_HO_OO_HH_OH_GOFR_OUT)) finally: silent_remove(DEF_GOFR_OUT, disable=DISABLE_REMOVE)
def testOHGofR(self): try: main(["-c", OH_GOFR_INI_PATH]) self.assertFalse(diff_lines(DEF_GOFR_OUT, GOOD_OH_GOFR_OUT_PATH)) finally: silent_remove(DEF_GOFR_OUT, disable=DISABLE_REMOVE)
def testEmptyList(self): test_input = ["-c", EMPTY_LIST_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("Found no dump files to process" in output)
def testMissNewHIJMissingParam(self): test_input = ["-c", HIJ_NEW_MISS_PARAM_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("Missing input value for key" in output)
def testMissNewHIJNonfloatParam(self): test_input = ["-c", HIJ_NEW_NONFLOAT_PARAM_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("Require float inputs for keys" in output)