def testSpecificTimestep(self): try: test_input = ["-c", ONLY_STEPS_INI] main(test_input) self.assertFalse(diff_lines(ONLY_STEPS_OUT, GOOD_ONLY_STEPS_OUT)) finally: silent_remove(ONLY_STEPS_OUT, disable=DISABLE_REMOVE)
def testMaxSteps(self): try: test_input = ["-c", MAX_STEPS_INI] main(test_input) self.assertFalse(diff_lines(MAX_STEPS_OUT, GOOD_MAX_STEPS_OUT)) finally: silent_remove(MAX_STEPS_OUT, disable=DISABLE_REMOVE)
def testWaterMolCombine(self): # Should skip the timestep with only 1 state try: main(["-c", WATER_MOL_COMB_INI]) self.assertFalse(diff_lines(WATER_MOL_COMB_OUT, GOOD_WATER_MOL_COMB_OUT)) finally: silent_remove(WATER_MOL_COMB_OUT)
def testMissingInfo(self): test_input = ["-c", INCOMP_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("Missing config val for key 'prot_res_mol_id'" 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 testRepeatedTimestep(self): try: test_input = ["-c", REPEATED_EVB_STEP_INI] main(test_input) self.assertFalse( diff_lines(REPEATED_EVB_STEP_OUT, GOOD_REPEATED_EVB_STEP_OUT)) finally: silent_remove(REPEATED_EVB_STEP_OUT, disable=DISABLE_REMOVE)
def testWaterMol(self): try: main(["-c", WATER_MOL_INI]) self.assertFalse(diff_lines(WATER_MOL_OUT1, GOOD_WATER_MOL_OUT1)) self.assertFalse(diff_lines(WATER_MOL_OUT2, GOOD_WATER_MOL_OUT2)) finally: silent_remove(WATER_MOL_OUT1, disable=DISABLE_REMOVE) silent_remove(WATER_MOL_OUT2, disable=DISABLE_REMOVE)
def testWaterMol(self): try: main(["-c", WATER_MOL_INI, "-p"]) self.assertFalse(diff_lines(DEF_CI_OUT1, GOOD_WATER_MOL_OUT1)) self.assertFalse(diff_lines(DEF_CI_OUT2, GOOD_WATER_MOL_OUT2)) finally: silent_remove(DEF_CI_OUT1, disable=DISABLE_REMOVE) silent_remove(DEF_CI_OUT2, disable=DISABLE_REMOVE)
def testWaterMolCombine(self): # Should skip the timestep with only 1 state try: main(["-c", WATER_MOL_COMB_INI, "-p"]) self.assertFalse( diff_lines(WATER_MOL_COMB_OUT, GOOD_WATER_MOL_COMB_OUT)) finally: silent_remove(WATER_MOL_COMB_OUT, disable=DISABLE_REMOVE)
def testNoIni(self): test_input = [] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stdout(main, test_input) as output: self.assertTrue("usage:" in output) with capture_stderr(main, test_input) as output: self.assertTrue("Problems reading file: Could not read file" in output)
def testCiInfo(self): try: main(["-c", CI_INI]) self.assertFalse(diff_lines(DEF_CI_OUT1, GOOD_CI_OUT1)) self.assertEqual(1, len(diff_lines(DEF_CI_OUT2, BAD_CI_OUT2))) self.assertFalse(diff_lines(DEF_CI_OUT2, GOOD_CI_OUT2)) finally: silent_remove(DEF_CI_OUT1, disable=DISABLE_REMOVE) silent_remove(DEF_CI_OUT2, disable=DISABLE_REMOVE)
def testNoIni(self): test_input = [] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stdout(main, test_input) as output: self.assertTrue("usage:" in output) with capture_stderr(main, test_input) as output: self.assertTrue( "Problems reading file: Could not read file" in output)
def testMissingInfo(self): test_input = ["-c", INCOMP_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue( "Missing config val for key 'prot_res_mol_id'" in output) with capture_stdout(main, test_input) as output: self.assertTrue("optional arguments" in output)
def testRelEnergyMissingInfo(self): # Check that prints "nan" instead of printing a stack trace (uncaught error) try: main(["-c", REL_ENE_INI2, "-p"]) print(REL_ENE_OUT2) print(GOOD_REL_ENE_OUT2) self.assertFalse(diff_lines(REL_ENE_OUT2, GOOD_REL_ENE_OUT2)) finally: silent_remove(REL_ENE_OUT2, disable=DISABLE_REMOVE)
def testRelEnergy(self): # calculates relative energy try: main(["-c", REL_ENE_INI, "-p"]) print(REL_ENE_OUT) print(GOOD_REL_ENE_OUT) self.assertFalse(diff_lines(REL_ENE_OUT, GOOD_REL_ENE_OUT)) finally: silent_remove(REL_ENE_OUT, disable=DISABLE_REMOVE)
def testCiInfo(self): try: main(["-c", CI_INI]) self.assertFalse(diff_lines(DEF_CI_OUT1, GOOD_CI_OUT1)) self.assertEquals(1, len(diff_lines(DEF_CI_OUT2, BAD_CI_OUT2))) self.assertFalse(diff_lines(DEF_CI_OUT2, GOOD_CI_OUT2)) finally: silent_remove(DEF_CI_OUT1) silent_remove(DEF_CI_OUT2)
def testOneStateCiInfo(self): """ Make sure can handle input that only has one state (such steps have a vector instead of a matrix) and does not skip them Also, check that properly reads to make a summary file """ try: main(["-c", CI_ONE_STATE_INI]) self.assertFalse(diff_lines(DEF_LIST_OUT, GOOD_LIST_OUT)) finally: silent_remove(DEF_LIST_OUT)
def testOneStateCiInfo(self): """ Make sure can handle input that only has one state (such steps have a vector instead of a matrix) and does not skip them Also, check that properly reads to make a summary file """ try: main(["-c", CI_ONE_STATE_INI]) self.assertFalse(diff_lines(DEF_LIST_OUT, GOOD_LIST_OUT)) finally: silent_remove(DEF_LIST_OUT, disable=DISABLE_REMOVE)
def testMultiFileSum(self): try: test_input = ["-c", MULTI_SUM_INI] silent_remove(MULTI_SUM_OUT) if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue( "setting 'print_output_file_list' to 'True'" in output) self.assertFalse(diff_lines(MULTI_SUM_OUT, GOOD_MULTI_SUM_OUT)) finally: silent_remove(MULTI_SUM_OUT, disable=DISABLE_REMOVE)
def testRMSDEnergy(self): try: test_input = ["-c", RMSD_ENE_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stdout(main, test_input) as output: self.assertTrue("23.760125" in output) print(REL_ENE_OUT2) print(GOOD_RMSD_ENE_OUT) self.assertFalse(diff_lines(REL_ENE_OUT2, GOOD_RMSD_ENE_OUT)) finally: silent_remove(REL_ENE_OUT2, disable=DISABLE_REMOVE)
def testOneStateEachFileCiInfo(self): """ Make sure can handle input that only has one state (such steps have a vector instead of a matrix) this time, printing a separate output for each file And, skip one-state-steps """ try: main(["-c", CI_ONE_STATE_EACH_FILE_INI]) self.assertFalse(diff_lines(DEF_ONE_STATE_OUT, GOOD_ONE_STATE_OUT)) self.assertFalse(diff_lines(DEF_ONE_STATE_OUT2, GOOD_ONE_STATE_OUT2)) finally: silent_remove(DEF_ONE_STATE_OUT) silent_remove(DEF_ONE_STATE_OUT2)
def testOneStateEachFileCiInfo(self): """ Make sure can handle input that only has one state (such steps have a vector instead of a matrix) this time, printing a separate output for each file And, skip one-state-steps """ try: main(["-c", CI_ONE_STATE_EACH_FILE_INI]) self.assertFalse(diff_lines(DEF_ONE_STATE_OUT, GOOD_ONE_STATE_OUT)) self.assertFalse( diff_lines(DEF_ONE_STATE_OUT2, GOOD_ONE_STATE_OUT2)) finally: silent_remove(DEF_ONE_STATE_OUT, disable=DISABLE_REMOVE) silent_remove(DEF_ONE_STATE_OUT2, disable=DISABLE_REMOVE)
def testNonIntTimestep(self): test_input = ["-c", REF_ENE_NON_INT_TIME_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("Could not convert" in output)
def testKeyProps(self): try: main(["-c", KEY_PROPS_INI]) self.assertFalse(diff_lines(KEY_PROPS_OUT, GOOD_KEY_PROPS_OUT)) finally: silent_remove(KEY_PROPS_OUT, disable=DISABLE_REMOVE)
def testDecomposedEnergyInfo(self): try: main(["-c", DECOMP_ENE_INI, "-p"]) self.assertFalse(diff_lines(REL_ENE_OUT2, GOOD_DECOMP_ENE_OUT)) finally: silent_remove(REL_ENE_OUT2, disable=DISABLE_REMOVE)
def testNoPath(self): test_input = ["-c", NO_PATH_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("Found no evb file names" in output)
def testKeyProps(self): try: main(["-c", KEY_PROPS_INI]) self.assertFalse(diff_lines(KEY_PROPS_OUT, GOOD_KEY_PROPS_OUT)) finally: silent_remove(KEY_PROPS_OUT)
def testBadPath(self): test_input = ["-c", BAD_PATH_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)
def testBadPath(self): test_input = ["-c", BAD_PATH_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("Found no evb file names to read" in output)