def testLastIni(self): test_input = ["-c", LAST_INI] try: main(test_input) self.assertFalse(diff_lines(PDB_OUT, GOOD_PDB_LAST_OUT)) finally: silent_remove(PDB_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 testSingle(self): test_input = ["-c", SINGLE_INI] try: main(test_input) self.assertFalse(diff_lines(SINGLE_OUT, GOOD_SINGLE_OUT)) finally: silent_remove(SINGLE_OUT, disable=DISABLE_REMOVE) pass
def testMultPDB(self): test_input = ["-c", MULT_PDB_INI] try: main(test_input) self.assertFalse(diff_lines(MULT_PDB_OUT, GOOD_MULT_PDB_OUT)) finally: silent_remove(MULT_PDB_OUT, disable=DISABLE_REMOVE) pass
def testComb2Ini(self): test_input = ["-c", COMB2_INI, "-o", "pet_mono_test_comb.pdb"] try: main(test_input) self.assertFalse(diff_lines(COMB_PDB_OUT, GOOD_COMB_PDB_OUT)) finally: silent_remove(COMB_PDB_OUT, disable=DISABLE_REMOVE) pass
def testFirstIni(self): test_input = ["-c", DEF_INI, "-a", "-o", 'pet_mono_f1hs_0.pdb'] try: main(test_input) self.assertFalse(diff_lines(ALT_PDB_OUT, GOOD_PDB_FIRST_OUT)) finally: silent_remove(ALT_PDB_OUT, disable=DISABLE_REMOVE) pass
def testUnrecognizedArg(self): test_input = ["-c", DEF_INI, "--ghost"] # main(test_input) 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 testCombIni(self): test_input = ["-c", COMB_INI] try: silent_remove(TEMP_DIR, dir_with_files=True) main(test_input) self.assertFalse(diff_lines(PDB12_OUT, GOOD_PDB12_LAST_OUT)) finally: silent_remove(PDB12_OUT, disable=DISABLE_REMOVE) silent_remove(TEMP_DIR, dir_with_files=True) pass
def testCommandLineFile(self): test_input = [ "-c", NO_LOG_INI, "-f", "tests/test_data/gausslog2pdb/pet_mono_f1hs_1.log", "-d", "tests/test_data/gausslog2pdb" ] try: main(test_input) self.assertFalse(diff_lines(PDB_OUT, GOOD_PDB_LAST_OUT)) finally: silent_remove(PDB_OUT, disable=DISABLE_REMOVE)
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)
def testNoLogFile(self): test_input = ["-c", NO_LOG_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("No files to process" in output)
def testRequestFirstLast(self): test_input = ["-c", DEF_INI, "-a", "-z"] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("Cannot specify both" in output)
def testMorePDBAtoms(self): test_input = ["-c", MORE_PDB_ATOMS_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("pdb template has" in output)
def testFewerPDBAtoms(self): test_input = ["-c", FEWER_PDB_ATOMS_INI] main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("has more atoms" in output)