当前位置: 首页>>代码示例>>Python>>正文


Python md_common.capture_stderr函数代码示例

本文整理汇总了Python中md_utils.md_common.capture_stderr函数的典型用法代码示例。如果您正苦于以下问题:Python capture_stderr函数的具体用法?Python capture_stderr怎么用?Python capture_stderr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了capture_stderr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testWrongFileToFilter

 def testWrongFileToFilter(self):
     # If put a configuration file as the file to read, fail well
     test_input = ["-f", DEF_INI, "-c", DEF_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("could not convert string" in output)
开发者ID:team-mayes,项目名称:md_utils,代码行数:7,代码来源:test_filter_col.py

示例2: testBinTooMany

 def testBinTooMany(self):
     test_input = ["-f", DEF_INPUT, "-c", BIN_TOO_MANY_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("Expected a comma-separated list of length 3 or 4 for section 'bin_settings' key 'cv'. "
                         "Read: 0.5,0.7,2,6,10" in output)
开发者ID:team-mayes,项目名称:md_utils,代码行数:7,代码来源:test_filter_col.py

示例3: testTplDumpMismatch

 def testTplDumpMismatch(self):
     try:
         with capture_stderr(evbdump2data.main, ["-c", TPL_DUMP_MISMATCH_INI]) as output:
             self.assertTrue("listed number of atoms (214084) does not equal the number of atoms in the "
                             "template data file (1429)" in output)
     finally:
         silent_remove(REPROD_TPL)
开发者ID:team-mayes,项目名称:md_utils,代码行数:7,代码来源:test_evbdump2data.py

示例4: testFindNoWatH

 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)
开发者ID:team-mayes,项目名称:md_utils,代码行数:7,代码来源:test_lammps_proc.py

示例5: testNotIni

 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)
开发者ID:team-mayes,项目名称:md_utils,代码行数:7,代码来源:test_data2pdb.py

示例6: testSubsetCiInfo

 def testSubsetCiInfo(self):
     with capture_stderr(main, ["-c", CI_SUBSET_INI]) as output:
         self.assertTrue("found no data from" in output)
         self.assertFalse(diff_lines(DEF_CI_SUBSET_OUT, GOOD_CI_SUBSET_OUT))
         silent_remove(DEF_CI_SUBSET_OUT)
         silent_remove(DEF_CI_OUT1)
         silent_remove(DEF_CI_OUT2)
开发者ID:team-mayes,项目名称:md_utils,代码行数:7,代码来源:test_evb_get_info.py

示例7: testIncompDump

 def testIncompDump(self):
     try:
         with capture_stderr(main, ["-c", INCOMP_DUMP_INI_PATH]) as output:
             self.assertTrue("WARNING" in output)
         self.assertFalse(diff_lines(DEF_GOFR_INCOMP_OUT, GOOD_HO_GOFR_OUT_PATH))
     finally:
         silent_remove(DEF_GOFR_INCOMP_OUT, disable=DISABLE_REMOVE)
开发者ID:team-mayes,项目名称:md_utils,代码行数:7,代码来源:test_lammps_proc.py

示例8: testNoSuchOption

 def testNoSuchOption(self):
     # main(["[email protected]", DEF_OUT])
     with capture_stderr(main, ["[email protected]", DEF_OUT]) as output:
         self.assertTrue("unrecognized argument" in output)
         self.assertTrue(DEF_OUT in output)
     with capture_stdout(main, ["[email protected]", DEF_OUT]) as output:
         self.assertTrue("optional arguments" in output)
开发者ID:team-mayes,项目名称:md_utils,代码行数:7,代码来源:test_calc_split_avg.py

示例9: testNoArgs

 def testNoArgs(self):
     test_input = []
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("Could not read file" in output)
     with capture_stdout(main, test_input) as output:
         self.assertTrue("optional arguments" in output)
开发者ID:team-mayes,项目名称:md_utils,代码行数:8,代码来源:test_dump_edit.py

示例10: testParseError

 def testParseError(self):
     # This input has a line with only "z" (no equals), resulting in a parsing error we will catch
     test_input = ["-f", DEF_INPUT, "-c", PARSE_ERROR_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("File contains parsing errors" in output)
         self.assertTrue("'z" in output)
开发者ID:team-mayes,项目名称:md_utils,代码行数:8,代码来源:test_filter_col.py

示例11: testMissingInfo

 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)
开发者ID:team-mayes,项目名称:md_utils,代码行数:8,代码来源:test_evb_get_info.py

示例12: testNoIni

 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)
开发者ID:team-mayes,项目名称:md_utils,代码行数:8,代码来源:test_evb_get_info.py

示例13: testDupCol

 def testDupCol(self):
     test_input = ["-f", DUP_COL_CMP_LIST]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertFalse(diff_lines(DEF_OUT, GOOD_OUT))
         self.assertTrue("Non-unique column" in output)
     silent_remove(DEF_OUT, disable=DISABLE_REMOVE)
开发者ID:team-mayes,项目名称:md_utils,代码行数:8,代码来源:test_align_on_col.py

示例14: testAddNothing

 def testAddNothing(self):
     # this first test does not really doing anything, and warns the user
     try:
         with capture_stderr(main, [INPUT_PATH]) as output:
             self.assertTrue("Return file will be the same as the input" in output)
         self.assertFalse(diff_lines(INPUT_PATH, DEF_OUT_PATH))
     finally:
         silent_remove(DEF_OUT_PATH)
开发者ID:team-mayes,项目名称:md_utils,代码行数:8,代码来源:test_add_to_each_line.py

示例15: testCompDihAlt

 def testCompDihAlt(self):
     # Test it is okay with sections in the 1st but not 2nd file
     with capture_stderr(main, ["-c", COMP_DIH_ALT_INI]) as output:
         self.assertTrue("WARNING:  Skipping section" in output)
     try:
         self.assertFalse(diff_lines(COMP_DIH_ALT_OUT, COMP_DIH_ALT_OUT_GOOD))
     finally:
         silent_remove(COMP_DIH_ALT_OUT, disable=DISABLE_REMOVE)
开发者ID:team-mayes,项目名称:md_utils,代码行数:8,代码来源:test_data_edit.py


注:本文中的md_utils.md_common.capture_stderr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。