MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / test

Function test

tools/python-3.11.9-amd64/Lib/cgi.py:853–890  ·  view source on GitHub ↗

Robust test CGI script, usable as main program. Write minimal HTTP headers and dump all information provided to the script in HTML form.

(environ=os.environ)

Source from the content-addressed store, hash-verified

851# ===============
852
853def test(environ=os.environ):
854 """Robust test CGI script, usable as main program.
855
856 Write minimal HTTP headers and dump all information provided to
857 the script in HTML form.
858
859 """
860 print("Content-type: text/html")
861 print()
862 sys.stderr = sys.stdout
863 try:
864 form = FieldStorage() # Replace with other classes to test those
865 print_directory()
866 print_arguments()
867 print_form(form)
868 print_environ(environ)
869 print_environ_usage()
870 def f():
871 exec("testing print_exception() -- <I>italics?</I>")
872 def g(f=f):
873 f()
874 print("<H3>What follows is a test, not an actual exception:</H3>")
875 g()
876 except:
877 print_exception()
878
879 print("<H1>Second try with a small maxlen...</H1>")
880
881 global maxlen
882 maxlen = 50
883 try:
884 form = FieldStorage() # Replace with other classes to test those
885 print_directory()
886 print_arguments()
887 print_form(form)
888 print_environ(environ)
889 except:
890 print_exception()
891
892def print_exception(type=None, value=None, tb=None, limit=None):
893 if type is None:

Callers 1

cgi.pyFile · 0.70

Calls 9

FieldStorageClass · 0.85
print_directoryFunction · 0.85
print_argumentsFunction · 0.85
print_formFunction · 0.85
print_environFunction · 0.85
print_environ_usageFunction · 0.85
gFunction · 0.70
print_exceptionFunction · 0.70
printFunction · 0.50

Tested by

no test coverage detected