def testInputFile(self): test_input = ["-c", MISS_KEY_INFO_INI, "-f", FITEVB_OUT] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue( "expected comma-separated numerical lower range" in output)
def testSumWOBest(self): test_input = ["-c", DA_GAUSS_INI, "-s", ORIG_ALL_BEST] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue( "specified, which is required with a specified" in output)
def testMissReqParams(self): test_input = ["-c", MISS_GROUP_NAME, "-f", FITEVB_OUT] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue( "In configuration file section 'REP1', missing parameter 'group_names'" in output)
def testRepExpon2(self): try: test_input = ["-c", ARQ_REP_EXPON2_INI, FIT_REP_EXPON2] main(test_input) self.assertFalse( diff_lines(SUB_DIR_DEF_OUT, GOOD_ARQ_REP_EXPON2_OUT)) finally: silent_remove(SUB_DIR_DEF_OUT, disable=DISABLE_REMOVE)
def testMissingBest(self): test_input = ["-c", DA_GAUSS_INI, "-f", FITEVB_OUT, "-r"] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue( "(16) does not equal the total number of values (15)" in output)
def testTooManyInFitEVBOut(self): test_input = ["-c", DA_GAUSS_INI, "-f", FITEVB_OUT_TOO_MANY] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue( "(15) does not equal the total number of values (17)" in output)
def testARQ2Fit(self): # In the EVB param file, this is option "PT" with "1-asymmetric" (confusing, huh?) test_input = ["-c", ARQ2_INI, FIT_HIJ, FIT_REP1] try: main(test_input) self.assertFalse(diff_lines(SUB_DIR_DEF_OUT, GOOD_ARQ2_OUT)) finally: silent_remove(SUB_DIR_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 testWithBest(self): test_input = [ "-c", DA_GAUSS_INI, "-f", FITEVB_OUT_RESID, "-r", FIT_REP1, FIT_HIJ ] try: main(test_input) self.assertFalse(diff_lines(DEF_OUT, GOOD_NO_VII_FIT_OUT)) finally: silent_remove(DEF_OUT, disable=DISABLE_REMOVE)
def testNoOffDiagFit(self): test_input = [ "-c", NO_OFF_DIAG_INI, "-f", NO_OFF_DIAG_FITEVB_OUT, FIT_REP1 ] try: main(test_input) self.assertFalse(diff_lines(SUB_DIR_DEF_OUT, GOOD_NO_OFF_DIAG_OUT)) finally: silent_remove(SUB_DIR_DEF_OUT, disable=DISABLE_REMOVE)
def testMissingParam(self): test_input = [ "-c", MISS_PARAM_INI, "-f", FITEVB_OUT, ] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("missing parameter" in output)
def testCollectBestWResidNoInitialBest(self): try: # Ensure that this is not already a summary file silent_remove(ALL_BEST_STR, disable=DISABLE_REMOVE) main([ "-c", DA_GAUSS_INI, "-f", FITEVB_OUT1, "-s", ALL_BEST_STR, "-r", FIT_HIJ, FIT_REP1 ]) self.assertFalse(diff_lines(DEF_OUT, GOOD_INP_OUT1)) self.assertFalse(diff_lines(ALL_BEST_STR, GOOD_ALL_BEST_NEW)) finally: silent_remove(DEF_OUT, disable=DISABLE_REMOVE) silent_remove(ALL_BEST_STR, disable=DISABLE_REMOVE)
def testCollectBestWResid1(self): try: shutil.copyfile(ORIG_ALL_BEST1, ALL_BEST) main([ "-c", DA_GAUSS_INI, "-f", FITEVB_OUT1, "-s", ALL_BEST, "-r", FIT_HIJ, FIT_REP1 ]) self.assertFalse(diff_lines(DEF_OUT, GOOD_INP_OUT1)) self.assertFalse(diff_lines(ALL_BEST, GOOD_ALL_BEST1)) self.assertFalse(diff_lines(ALL_BEST_CSV, GOOD_ALL_BEST_CSV1)) self.assertFalse(diff_lines(ALL_BEST_DIFF, GOOD_ALL_BEST_DIFF1)) finally: silent_remove(DEF_OUT, disable=DISABLE_REMOVE) silent_remove(ALL_BEST, disable=DISABLE_REMOVE) silent_remove(ALL_BEST_CSV, disable=DISABLE_REMOVE) silent_remove(ALL_BEST_DIFF, disable=DISABLE_REMOVE)
def testAddSummarySuffix(self): try: shutil.copyfile(ORIG_ALL_BEST_ARQ2, ALL_BEST) main([ "-c", ARQ7_INI, "-f", FITEVB_ARQ2_BEST, "-s", ALL_BEST, "-r", FIT_REP1, FIT_HIJ ]) self.assertFalse(diff_lines(SUB_DIR_DEF_OUT, GOOD_INP_ARQ7_OUT)) self.assertFalse(diff_lines(ALL_BEST, GOOD_ALL_BEST_ARQ7)) self.assertFalse( diff_lines(SUB_DATA_ALL_BEST_CSV, GOOD_ALL_BEST_ARQ7_CSV)) # self.assertFalse(diff_lines(SUB_ALL_BEST_DIFF, GOOD_ARQ7_PERC_DIFF)) finally: silent_remove(SUB_DIR_DEF_OUT, disable=DISABLE_REMOVE) silent_remove(ALL_BEST, disable=DISABLE_REMOVE) silent_remove(SUB_DATA_ALL_BEST_CSV, disable=DISABLE_REMOVE) silent_remove(SUB_ALL_BEST_DIFF, disable=DISABLE_REMOVE)
def testViiFit(self): try: fitevb_setup.main(["-c", INI_PATH, "-f", FITEVB_OUTPUT_PATH, "-v", "True"]) self.assertFalse(diff_lines(DEF_OUT_PATH, GOOD_VII_FIT_OUT_PATH)) finally: silent_remove(DEF_OUT_PATH)
def testWrongSectionIni(self): test_input = ["-c", WRONG_SECTION_INI, "-f", FITEVB_OUT] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("program expects only sections" in output)
def testViiFit(self): try: main(["-c", DA_GAUSS_INI, "-f", FITEVB_OUT, FIT_VII]) self.assertFalse(diff_lines(DEF_OUT, GOOD_VII_FIT_OUT)) finally: silent_remove(DEF_OUT, disable=DISABLE_REMOVE)
def testGhostFile(self): test_input = ["-c", DA_GAUSS_INI, "-f", GHOST_STR] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("Problems reading specified" in output)
def testNoFitEVBOut(self): try: main(["-c", DA_GAUSS_INI]) self.assertFalse(diff_lines(DEF_OUT, GOOD_NO_INITIAL_OUT)) finally: silent_remove(DEF_OUT, disable=DISABLE_REMOVE)
def testExtraParams(self): test_input = ["-c", MISS_SEC_INI, "-f", FITEVB_OUT] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("already exists" in output)
def testGhostDir(self): test_input = ["-c", BAD_DIR_INI, "-f", FITEVB_OUT] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("Invalid directory" in output)