• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python md_common.capture_stderr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: testHelp

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


示例17: testBadInput

 def testBadInput(self):
     # Test what happens when cannot convert a value to float
     try:
         with capture_stderr(main, ["-f", BAD_INPUT]) as output:
             self.assertTrue("could not be converted to a float" in output)
             self.assertFalse(diff_lines(BAD_INPUT_OUT, GOOD_BAD_INPUT_OUT))
     finally:
         silent_remove(BAD_INPUT_OUT, disable=DISABLE_REMOVE)
开发者ID:team-mayes,项目名称:md_utils,代码行数:8,代码来源:test_col_stats.py


示例18: testMissingConfig

 def testMissingConfig(self):
     test_input = ["-c", INCOMP_INI_PATH]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("Missing config val for key 'water_o_type'" in output)
     with capture_stdout(main, test_input) as output:
         self.assertTrue("optional arguments" in output)
开发者ID:team-mayes,项目名称:md_utils,代码行数:8,代码来源:test_lammps_proc.py


示例19: testGluBadDump

 def testGluBadDump(self):
     # main(["-c", GLU_BAD_DATA_INI])
     try:
         with capture_stderr(main, ["-c", GLU_BAD_DATA_INI]) as output:
             self.assertTrue("Problems reading data: Unexpected line in file tests/test_data/evbd2d/glu_bad.dump: "
                             "ITEM: XYZ MS id mol type q x y z" in output)
     finally:
         silent_remove(REPROD_TPL)
开发者ID:team-mayes,项目名称:md_utils,代码行数:8,代码来源:test_evbdump2data.py


示例20: testNoHydData

 def testNoHydData(self):
     """
     Because the types do not match the data file, did not find the molecules desired.
     """
     evbdump2data.main(["-c", GLU_BAD_ATOM_TYPE_INI])
     with capture_stderr(evbdump2data.main, ["-c", GLU_BAD_ATOM_TYPE_INI]) as output:
         self.assertTrue("Check the data file" in output)
     silent_remove(REPROD_TPL)
开发者ID:team-mayes,项目名称:md_utils,代码行数:8,代码来源:test_evbdump2data.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python md_common.diff_lines函数代码示例发布时间:2022-05-27
下一篇:
Python mdTestUtilities.makeTempDir函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap