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


Python cmd.stdin方法代码示例

本文整理汇总了Python中cmd.stdin方法的典型用法代码示例。如果您正苦于以下问题:Python cmd.stdin方法的具体用法?Python cmd.stdin怎么用?Python cmd.stdin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cmd的用法示例。


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

示例1: test_input_reset_at_EOF

# 需要导入模块: import cmd [as 别名]
# 或者: from cmd import stdin [as 别名]
def test_input_reset_at_EOF(self):
        input = StringIO.StringIO("print test\nprint test2")
        output = StringIO.StringIO()
        cmd = self.simplecmd2(stdin=input, stdout=output)
        cmd.use_rawinput = False
        cmd.cmdloop()
        self.assertMultiLineEqual(output.getvalue(),
            ("(Cmd) test\n"
             "(Cmd) test2\n"
             "(Cmd) *** Unknown syntax: EOF\n"))
        input = StringIO.StringIO("print \n\n")
        output = StringIO.StringIO()
        cmd.stdin = input
        cmd.stdout = output
        cmd.cmdloop()
        self.assertMultiLineEqual(output.getvalue(),
            ("(Cmd) \n"
             "(Cmd) \n"
             "(Cmd) *** Unknown syntax: EOF\n")) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:21,代码来源:test_cmd.py

示例2: test_input_reset_at_EOF

# 需要导入模块: import cmd [as 别名]
# 或者: from cmd import stdin [as 别名]
def test_input_reset_at_EOF(self):
        input = io.StringIO("print test\nprint test2")
        output = io.StringIO()
        cmd = self.simplecmd2(stdin=input, stdout=output)
        cmd.use_rawinput = False
        cmd.cmdloop()
        self.assertMultiLineEqual(output.getvalue(),
            ("(Cmd) test\n"
             "(Cmd) test2\n"
             "(Cmd) *** Unknown syntax: EOF\n"))
        input = io.StringIO("print \n\n")
        output = io.StringIO()
        cmd.stdin = input
        cmd.stdout = output
        cmd.cmdloop()
        self.assertMultiLineEqual(output.getvalue(),
            ("(Cmd) \n"
             "(Cmd) \n"
             "(Cmd) *** Unknown syntax: EOF\n")) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:21,代码来源:test_cmd.py

示例3: test_file_with_missing_final_nl

# 需要导入模块: import cmd [as 别名]
# 或者: from cmd import stdin [as 别名]
def test_file_with_missing_final_nl(self):
        input = StringIO.StringIO("print test\nprint test2")
        output = StringIO.StringIO()
        cmd = self.simplecmd(stdin=input, stdout=output)
        cmd.use_rawinput = False
        cmd.cmdloop()
        self.assertMultiLineEqual(output.getvalue(),
            ("(Cmd) test\n"
             "(Cmd) test2\n"
             "(Cmd) ")) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:12,代码来源:test_cmd.py

示例4: test_file_with_missing_final_nl

# 需要导入模块: import cmd [as 别名]
# 或者: from cmd import stdin [as 别名]
def test_file_with_missing_final_nl(self):
        input = io.StringIO("print test\nprint test2")
        output = io.StringIO()
        cmd = self.simplecmd(stdin=input, stdout=output)
        cmd.use_rawinput = False
        cmd.cmdloop()
        self.assertMultiLineEqual(output.getvalue(),
            ("(Cmd) test\n"
             "(Cmd) test2\n"
             "(Cmd) ")) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:12,代码来源:test_cmd.py


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