def testGlu(self): try: data2pdb.main(["-c", GLU_INI]) self.assertFalse(diff_lines(GLU_OUT, GOOD_GLU_OUT)) finally: silent_remove(PDB_TPL_OUT) silent_remove(GLU_OUT)
def testNotIni(self): # gracefully fail if give the wrong file to the -c option test_input = ["-c", NOT_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue("WARNING: File contains no section headers" in output)
def testNotIni(self): # gracefully fail if give the wrong file to the -c option test_input = ["-c", NOT_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) with capture_stderr(main, test_input) as output: self.assertTrue( "WARNING: File contains no section headers" 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 testDefIni(self): test_input = ["-c", DEF_INI] if logger.isEnabledFor(logging.DEBUG): main(test_input) try: main(test_input) self.assertFalse(diff_lines(PDB_OUT, GOOD_PDB_OUT)) finally: silent_remove(PDB_TPL_OUT) silent_remove(PDB_OUT)
def testGluDict(self): try: data2pdb.main(["-c", GLU_DICT_INI]) self.assertFalse(diff_lines(GLU_OUT, GOOD_GLU_OUT)) with open(DEF_DICT_OUT, 'r') as d_file: dict_test = json.load(d_file) with open(GOOD_DICT, 'r') as d_file: dict_good = json.load(d_file) self.assertEqual(dict_test, dict_good) finally: silent_remove(PDB_TPL_OUT) silent_remove(GLU_OUT) silent_remove(DEF_DICT_OUT)