From: <am...@us...> - 2009-10-06 12:39:05
|
Revision: 6841 http://jython.svn.sourceforge.net/jython/?rev=6841&view=rev Author: amak Date: 2009-10-06 12:38:52 +0000 (Tue, 06 Oct 2009) Log Message: ----------- Tabs to spaces. Modified Paths: -------------- trunk/jython/tests/modjy/test_apps_dir/content_header_tests.py trunk/jython/tests/modjy/test_apps_dir/environ_tests.py trunk/jython/tests/modjy/test_apps_dir/header_tests.py trunk/jython/tests/modjy/test_apps_dir/return_tests.py trunk/jython/tests/modjy/test_apps_dir/simple_app.py trunk/jython/tests/modjy/test_apps_dir/stream_tests.py trunk/jython/tests/modjy/test_apps_dir/web_inf_tests.py Modified: trunk/jython/tests/modjy/test_apps_dir/content_header_tests.py =================================================================== --- trunk/jython/tests/modjy/test_apps_dir/content_header_tests.py 2009-10-06 12:27:51 UTC (rev 6840) +++ trunk/jython/tests/modjy/test_apps_dir/content_header_tests.py 2009-10-06 12:38:52 UTC (rev 6841) @@ -21,7 +21,7 @@ ### """ - A variety of app callables used to test content related headers. + A variety of app callables used to test content related headers. """ def test_set_content_length(environ, start_response): Modified: trunk/jython/tests/modjy/test_apps_dir/environ_tests.py =================================================================== --- trunk/jython/tests/modjy/test_apps_dir/environ_tests.py 2009-10-06 12:27:51 UTC (rev 6840) +++ trunk/jython/tests/modjy/test_apps_dir/environ_tests.py 2009-10-06 12:38:52 UTC (rev 6841) @@ -22,50 +22,50 @@ """ - A variety of app callables used to test the WSGI environment. + A variety of app callables used to test the WSGI environment. """ def test_echo_wsgi_env(environ, start_response): - writer = start_response("200 OK", []) - output_dict = {} - for k in environ["QUERY_STRING"].split(';'): - output_dict[k] = environ[k] - return [repr(output_dict)] + writer = start_response("200 OK", []) + output_dict = {} + for k in environ["QUERY_STRING"].split(';'): + output_dict[k] = environ[k] + return [repr(output_dict)] def test_env_is_dict(environ, start_response): - writer = start_response("200 OK", []) - if type(environ) is type({}): - writer("true") - else: - writer("false") - return [] + writer = start_response("200 OK", []) + if type(environ) is type({}): + writer("true") + else: + writer("false") + return [] def test_env_is_mutable(environ, start_response): - writer = start_response("200 OK", []) - try: - environ['some_key'] = 'some value' - writer("true") - except: - writer("false") - return [] + writer = start_response("200 OK", []) + try: + environ['some_key'] = 'some value' + writer("true") + except: + writer("false") + return [] def test_env_contains_request_method(environ, start_response): - writer = start_response("200 OK", []) - try: - writer(environ['REQUEST_METHOD']) - except KeyError, k: - writer(str(k)) - return [] + writer = start_response("200 OK", []) + try: + writer(environ['REQUEST_METHOD']) + except KeyError, k: + writer(str(k)) + return [] def test_env_script_name_path_info(environ, start_response): - writer = start_response("200 OK", []) - writer("%s:::%s" % (environ['SCRIPT_NAME'], environ['PATH_INFO'])) - return [] + writer = start_response("200 OK", []) + writer("%s:::%s" % (environ['SCRIPT_NAME'], environ['PATH_INFO'])) + return [] def test_env_query_string(environ, start_response): - writer = start_response("200 OK", []) - writer(environ['QUERY_STRING']) - return [] + writer = start_response("200 OK", []) + writer(environ['QUERY_STRING']) + return [] required_cgi_vars = [ 'REQUEST_METHOD', Modified: trunk/jython/tests/modjy/test_apps_dir/header_tests.py =================================================================== --- trunk/jython/tests/modjy/test_apps_dir/header_tests.py 2009-10-06 12:27:51 UTC (rev 6840) +++ trunk/jython/tests/modjy/test_apps_dir/header_tests.py 2009-10-06 12:38:52 UTC (rev 6841) @@ -21,118 +21,118 @@ ### """ - A variety of app callables used to test the WSGI headers. + A variety of app callables used to test the WSGI headers. """ def test_invalid_status_code(environ, start_response): - writer = start_response("twohundred ok", []) - # Should never get here - writer("D'oh!") - return [] + writer = start_response("twohundred ok", []) + # Should never get here + writer("D'oh!") + return [] def test_non_latin1_status_string(environ, start_response): - writer = start_response(u"200 \u03c9\u03ba", []) # "200 Omega Kappa" - # Should never get here - writer("D'oh!") - return [] + writer = start_response(u"200 \u03c9\u03ba", []) # "200 Omega Kappa" + # Should never get here + writer("D'oh!") + return [] def test_control_chars_in_status_string(environ, start_response): - writer = start_response(u"200 OK\x08\x08Hoopy", []) # "200 OK^H^HHoopy" - # Should never get here - writer("D'oh!") - return [] + writer = start_response(u"200 OK\x08\x08Hoopy", []) # "200 OK^H^HHoopy" + # Should never get here + writer("D'oh!") + return [] def test_headers_not_list(environ, start_response): - qstring = environ['QUERY_STRING'] - if qstring == '1': - headers = {} - elif qstring == '2': - headers = () - elif qstring == '3': - headers = 1 - else: - headers = None - writer = start_response("200 OK", headers) - # Should never get here - writer("D'oh!") - return [] + qstring = environ['QUERY_STRING'] + if qstring == '1': + headers = {} + elif qstring == '2': + headers = () + elif qstring == '3': + headers = 1 + else: + headers = None + writer = start_response("200 OK", headers) + # Should never get here + writer("D'oh!") + return [] def test_headers_list_non_tuples(environ, start_response): - qstring = environ['QUERY_STRING'] - if qstring == '1': - header = {} - elif qstring == '2': - header = [] - elif qstring == '3': - header = 1 - else: - header = None - headers = [header] - writer = start_response("200 OK", headers) - # Should never get here - writer("D'oh!") - return [] + qstring = environ['QUERY_STRING'] + if qstring == '1': + header = {} + elif qstring == '2': + header = [] + elif qstring == '3': + header = 1 + else: + header = None + headers = [header] + writer = start_response("200 OK", headers) + # Should never get here + writer("D'oh!") + return [] def test_headers_list_wrong_length_tuples(environ, start_response): - qstring = environ['QUERY_STRING'] - length = int(qstring) - if length == 2: length = 3 - header_tuple = tuple(range(int(qstring))) - headers = [header_tuple] - writer = start_response("200 OK", headers) - # Should never get here - writer("D'oh!") - return [] + qstring = environ['QUERY_STRING'] + length = int(qstring) + if length == 2: length = 3 + header_tuple = tuple(range(int(qstring))) + headers = [header_tuple] + writer = start_response("200 OK", headers) + # Should never get here + writer("D'oh!") + return [] def test_headers_list_wrong_types_in_tuples(environ, start_response): - qstring = environ['QUERY_STRING'] - if qstring == '1': - headers = [(1, 1)] - elif qstring == '2': - headers = [('header_name', 1L)] - elif qstring == '3': - headers = [('header_name', None)] - elif qstring == '4': - headers = [('header_name', 42.0)] - else: - headers = [(None, 'value')] - writer = start_response("200 OK", headers) - # Should never get here - writer("D'oh!") - return [] + qstring = environ['QUERY_STRING'] + if qstring == '1': + headers = [(1, 1)] + elif qstring == '2': + headers = [('header_name', 1L)] + elif qstring == '3': + headers = [('header_name', None)] + elif qstring == '4': + headers = [('header_name', 42.0)] + else: + headers = [(None, 'value')] + writer = start_response("200 OK", headers) + # Should never get here + writer("D'oh!") + return [] def test_headers_list_contains_non_latin1_values(environ, start_response): - headers = [('x-unicoded-header', u'\u03b1\u03b2\u03b3\u03b4\u03b5')] - writer = start_response("200 OK", headers) - # Should never get here - writer("D'oh!") - return [] + headers = [('x-unicoded-header', u'\u03b1\u03b2\u03b3\u03b4\u03b5')] + writer = start_response("200 OK", headers) + # Should never get here + writer("D'oh!") + return [] def test_headers_list_contains_values_with_control_chars(environ, start_response): - headers = [('x-control-coded-header', 'your father smelled of elder\x08\x08\x08\x08\x08loganberries')] - writer = start_response("200 OK", headers) - # Should never get here - writer("D'oh!") - return [] + headers = [('x-control-coded-header', 'your father smelled of elder\x08\x08\x08\x08\x08loganberries')] + writer = start_response("200 OK", headers) + # Should never get here + writer("D'oh!") + return [] def test_headers_list_contains_accented_latin1_values(environ, start_response): - name, value = environ['QUERY_STRING'].split('=') - headers = [(name, value)] - writer = start_response("200 OK", headers) - writer("Doesn't matter") - return [] + name, value = environ['QUERY_STRING'].split('=') + headers = [(name, value)] + writer = start_response("200 OK", headers) + writer("Doesn't matter") + return [] def test_headers_list_contains_accented_latin1_values(environ, start_response): - name, value = environ['QUERY_STRING'].split('=') - headers = [(name, value)] - writer = start_response("200 OK", headers) - writer("Doesn't matter") - return [] + name, value = environ['QUERY_STRING'].split('=') + headers = [(name, value)] + writer = start_response("200 OK", headers) + writer("Doesn't matter") + return [] def test_hop_by_hop(environ, start_response): - qstring = environ['QUERY_STRING'] - headers = [(qstring, 'doesnt matter')] - writer = start_response("200 OK", headers) - # Should never get here - writer("D'oh!") - return [] + qstring = environ['QUERY_STRING'] + headers = [(qstring, 'doesnt matter')] + writer = start_response("200 OK", headers) + # Should never get here + writer("D'oh!") + return [] Modified: trunk/jython/tests/modjy/test_apps_dir/return_tests.py =================================================================== --- trunk/jython/tests/modjy/test_apps_dir/return_tests.py 2009-10-06 12:27:51 UTC (rev 6840) +++ trunk/jython/tests/modjy/test_apps_dir/return_tests.py 2009-10-06 12:38:52 UTC (rev 6841) @@ -21,18 +21,18 @@ ### """ - A variety of app callables used to test return types. + A variety of app callables used to test return types. """ def test_non_iterable_return(environ, start_response): writer = start_response("200 OK", []) query_string = environ['QUERY_STRING'] return_object = { - 'int': 42, - 'float': 42.0, - 'str': "Strings are not permitted return values", - 'unicode': u"Unicode strings are not permitted return values", - 'none': None, + 'int': 42, + 'float': 42.0, + 'str': "Strings are not permitted return values", + 'unicode': u"Unicode strings are not permitted return values", + 'none': None, }[query_string] return return_object @@ -40,9 +40,9 @@ writer = start_response("200 OK", []) query_string = environ['QUERY_STRING'] return_object = { - 'int': 42, - 'float': 42.0, - 'none': None, + 'int': 42, + 'float': 42.0, + 'none': None, }[query_string] return [return_object] Modified: trunk/jython/tests/modjy/test_apps_dir/simple_app.py =================================================================== --- trunk/jython/tests/modjy/test_apps_dir/simple_app.py 2009-10-06 12:27:51 UTC (rev 6840) +++ trunk/jython/tests/modjy/test_apps_dir/simple_app.py 2009-10-06 12:38:52 UTC (rev 6841) @@ -22,6 +22,6 @@ def simple_app(environ, start_response): - writer = start_response("200 OK", []) - writer("Hello World!") - return [] + writer = start_response("200 OK", []) + writer("Hello World!") + return [] Modified: trunk/jython/tests/modjy/test_apps_dir/stream_tests.py =================================================================== --- trunk/jython/tests/modjy/test_apps_dir/stream_tests.py 2009-10-06 12:27:51 UTC (rev 6840) +++ trunk/jython/tests/modjy/test_apps_dir/stream_tests.py 2009-10-06 12:38:52 UTC (rev 6841) @@ -21,80 +21,78 @@ ### """ - A variety of app callables used to test the WSGI streams. + A variety of app callables used to test the WSGI streams. """ from UserDict import UserDict def extract_params(qstring): - params = {} - if qstring: - name_vals = [t.split('=', 1) for t in qstring.split('&')] - for n, v in name_vals: params[n] = v - return params + params = {} + if qstring: + name_vals = [t.split('=', 1) for t in qstring.split('&')] + for n, v in name_vals: params[n] = v + return params def test_read_input_stream(environ, start_response): - writer = start_response("200 OK", []) - wsgi_input = environ['wsgi.input'] - params = extract_params(environ['QUERY_STRING']) - readsize = None - if params.has_key('readsize'): - readsize = int(params['readsize']) - if readsize: - pieces = [] - piece = wsgi_input.read(readsize) - while piece: - pieces.append(piece) - piece = wsgi_input.read(readsize) - data = ''.join(pieces) - else: - data = wsgi_input.read() - output_dict = {'data': data} - writer(repr(output_dict)) - return [] + writer = start_response("200 OK", []) + wsgi_input = environ['wsgi.input'] + params = extract_params(environ['QUERY_STRING']) + readsize = None + if params.has_key('readsize'): + readsize = int(params['readsize']) + if readsize: + pieces = [] + piece = wsgi_input.read(readsize) + while piece: + pieces.append(piece) + piece = wsgi_input.read(readsize) + data = ''.join(pieces) + else: + data = wsgi_input.read() + output_dict = {'data': data} + writer(repr(output_dict)) + return [] def test_readline_input_stream(environ, start_response): - writer = start_response("200 OK", []) - wsgi_input = environ['wsgi.input'] - params = extract_params(environ['QUERY_STRING']) - readsize = None - if params.has_key('readsize'): - readsize = int(params['readsize']) - if readsize: - data = wsgi_input.readline(readsize) - else: - data = wsgi_input.readline() - output_dict = {'data': data} - writer(repr(output_dict)) - return [] + writer = start_response("200 OK", []) + wsgi_input = environ['wsgi.input'] + params = extract_params(environ['QUERY_STRING']) + readsize = None + if params.has_key('readsize'): + readsize = int(params['readsize']) + if readsize: + data = wsgi_input.readline(readsize) + else: + data = wsgi_input.readline() + output_dict = {'data': data} + writer(repr(output_dict)) + return [] def test_readlines_input_stream(environ, start_response): - writer = start_response("200 OK", []) - wsgi_input = environ['wsgi.input'] - params = extract_params(environ['QUERY_STRING']) - readsize = None - if params.has_key('readsize'): - readsize = int(params['readsize']) - if readsize: - data = wsgi_input.readlines(readsize) - else: - data = wsgi_input.readlines() - output_dict = {'data': "$".join(data)} - writer(repr(output_dict)) - return [] + writer = start_response("200 OK", []) + wsgi_input = environ['wsgi.input'] + params = extract_params(environ['QUERY_STRING']) + readsize = None + if params.has_key('readsize'): + readsize = int(params['readsize']) + if readsize: + data = wsgi_input.readlines(readsize) + else: + data = wsgi_input.readlines() + output_dict = {'data': "$".join(data)} + writer(repr(output_dict)) + return [] def test_error_stream(environ, start_response): - writer = start_response("200 OK", []) - wsgi_errors = environ['wsgi.errors'] - error_msg = None - for method in ['flush', 'write', 'writelines', ]: - if not hasattr(wsgi_errors, method): - error_msg = "wsgi.errors has no '%s' attr" % method - if not error_msg and not callable(getattr(wsgi_errors, method)): - error_msg = "wsgi.errors.%s attr is not callable" % method - if error_msg: break - return_msg = error_msg or "success" - writer(return_msg) - return [] - - \ No newline at end of file + writer = start_response("200 OK", []) + wsgi_errors = environ['wsgi.errors'] + error_msg = None + for method in ['flush', 'write', 'writelines', ]: + if not hasattr(wsgi_errors, method): + error_msg = "wsgi.errors has no '%s' attr" % method + if not error_msg and not callable(getattr(wsgi_errors, method)): + error_msg = "wsgi.errors.%s attr is not callable" % method + if error_msg: break + return_msg = error_msg or "success" + writer(return_msg) + return [] Modified: trunk/jython/tests/modjy/test_apps_dir/web_inf_tests.py =================================================================== --- trunk/jython/tests/modjy/test_apps_dir/web_inf_tests.py 2009-10-06 12:27:51 UTC (rev 6840) +++ trunk/jython/tests/modjy/test_apps_dir/web_inf_tests.py 2009-10-06 12:38:52 UTC (rev 6841) @@ -22,7 +22,7 @@ """ - A variety of app callables used to test WEB-INF interactions. + A variety of app callables used to test WEB-INF interactions. """ def test_import_from_lib_python(environ, start_response): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |