Python cmd.stdout() Examples

The following are 30 code examples of cmd.stdout(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module cmd , or try the search function .
Example #1
Source File: test_cmd.py    From CTFCrackTools with GNU General Public License v3.0 6 votes vote down vote up
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")) 
Example #2
Source File: test_cmd.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
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")) 
Example #3
Source File: test_cmd.py    From ironpython3 with Apache License 2.0 6 votes vote down vote up
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")) 
Example #4
Source File: test_cmd.py    From CTFCrackTools-V2 with GNU General Public License v3.0 6 votes vote down vote up
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")) 
Example #5
Source File: test_cmd.py    From BinderFilter with MIT License 6 votes vote down vote up
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")) 
Example #6
Source File: test_cmd.py    From gcblue with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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")) 
Example #7
Source File: test_cmd.py    From Fluid-Designer with GNU General Public License v3.0 6 votes vote down vote up
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")) 
Example #8
Source File: test_cmd.py    From oss-ftp with MIT License 6 votes vote down vote up
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")) 
Example #9
Source File: test_cmd.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 6 votes vote down vote up
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")) 
Example #10
Source File: test_cmd.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def do_EOF(self, args):
            print >>self.stdout, '*** Unknown syntax: EOF'
            return True 
Example #11
Source File: test_cmd.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
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) ")) 
Example #12
Source File: test_cmd.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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) ")) 
Example #13
Source File: test_cmd.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def do_print(self, args):
            print(args, file=self.stdout) 
Example #14
Source File: test_cmd.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def do_EOF(self, args):
            print('*** Unknown syntax: EOF', file=self.stdout)
            return True 
Example #15
Source File: test_cmd.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
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) ")) 
Example #16
Source File: test_cmd.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def do_print(self, args):
            print >>self.stdout, args 
Example #17
Source File: test_cmd.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def do_EOF(self, args):
            print >>self.stdout, '*** Unknown syntax: EOF'
            return True 
Example #18
Source File: test_cmd.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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) ")) 
Example #19
Source File: test_cmd.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def do_print(self, args):
            print >>self.stdout, args 
Example #20
Source File: test_cmd.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def do_EOF(self, args):
            print >>self.stdout, '*** Unknown syntax: EOF'
            return True 
Example #21
Source File: test_cmd.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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) ")) 
Example #22
Source File: test_cmd.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def do_print(self, args):
            print >>self.stdout, args 
Example #23
Source File: test_cmd.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def do_print(self, args):
            print >>self.stdout, args 
Example #24
Source File: test_cmd.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def do_EOF(self, args):
            print('*** Unknown syntax: EOF', file=self.stdout)
            return True 
Example #25
Source File: test_cmd.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def do_print(self, args):
            print(args, file=self.stdout) 
Example #26
Source File: test_cmd.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
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) ")) 
Example #27
Source File: test_cmd.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def do_EOF(self, args):
            print('*** Unknown syntax: EOF', file=self.stdout)
            return True 
Example #28
Source File: test_cmd.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def do_print(self, args):
            print(args, file=self.stdout) 
Example #29
Source File: test_cmd.py    From oss-ftp with MIT License 5 votes vote down vote up
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) ")) 
Example #30
Source File: test_cmd.py    From oss-ftp with MIT License 5 votes vote down vote up
def do_EOF(self, args):
            print >>self.stdout, '*** Unknown syntax: EOF'
            return True