403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.202
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Python315/Lib/test/test_tkinter/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Python315/Lib/test/test_tkinter/test_tkinter_pipe.py
# test_tkinter_pipe.py
import unittest
import subprocess
import sys
from test import support


@unittest.skipUnless(support.has_subprocess_support, "test requires subprocess")
class TkinterPipeTest(unittest.TestCase):

    def test_tkinter_pipe_buffered(self):
        args = [sys.executable, "-i"]
        proc = subprocess.Popen(args,
                                 stdin=subprocess.PIPE,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
        proc.stdin.write(b"import tkinter\n")
        proc.stdin.write(b"interpreter = tkinter.Tcl()\n")
        proc.stdin.write(b"print('hello')\n")
        proc.stdin.write(b"print('goodbye')\n")
        proc.stdin.write(b"quit()\n")
        stdout, stderr = proc.communicate(timeout=support.SHORT_TIMEOUT)
        stdout = stdout.decode()
        self.assertEqual(stdout.split(), ['hello', 'goodbye'])

    def test_tkinter_pipe_unbuffered(self):
        args = [sys.executable, "-i", "-u"]
        proc = subprocess.Popen(args,
                                 stdin=subprocess.PIPE,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
        proc.stdin.write(b"import tkinter\n")
        proc.stdin.write(b"interpreter = tkinter.Tcl()\n")

        proc.stdin.write(b"print('hello')\n")
        proc.stdin.flush()
        stdout = proc.stdout.readline()
        stdout = stdout.decode()
        self.assertEqual(stdout.strip(), 'hello')

        proc.stdin.write(b"print('hello again')\n")
        proc.stdin.flush()
        stdout = proc.stdout.readline()
        stdout = stdout.decode()
        self.assertEqual(stdout.strip(), 'hello again')

        proc.stdin.write(b"print('goodbye')\n")
        proc.stdin.write(b"quit()\n")
        stdout, stderr = proc.communicate(timeout=support.SHORT_TIMEOUT)
        stdout = stdout.decode()
        self.assertEqual(stdout.strip(), 'goodbye')


if __name__ == "__main__":
    unittest.main()

Youez - 2016 - github.com/yon3zu
LinuXploit