From 43378f78c0108831f3e07717c5213f1fd17a3d39 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 29 May 2011 04:22:43 -0400 Subject: remove unused comments --- pyramid/tests/test_exceptions.py | 277 --------------------------------------- 1 file changed, 277 deletions(-) diff --git a/pyramid/tests/test_exceptions.py b/pyramid/tests/test_exceptions.py index bf06f0b2e..f2e577416 100644 --- a/pyramid/tests/test_exceptions.py +++ b/pyramid/tests/test_exceptions.py @@ -315,280 +315,3 @@ class TestHTTPForbidden(unittest.TestCase): class DummyRequest(object): exception = None -# from webob.request import Request -# from webob.exc import HTTPException -# from webob.exc import WSGIHTTPException -# from webob.exc import HTTPMethodNotAllowed -# from webob.exc import _HTTPMove -# from webob.exc import HTTPExceptionMiddleware - -# from nose.tools import eq_, ok_, assert_equal, assert_raises - -# def test_HTTPException(self): -# _called = [] -# _result = object() -# def _response(environ, start_response): -# _called.append((environ, start_response)) -# return _result -# environ = {} -# start_response = object() -# exc = HTTPException('testing', _response) -# ok_(exc.wsgi_response is _response) -# ok_(exc.exception is exc) -# result = exc(environ, start_response) -# ok_(result is result) -# assert_equal(_called, [(environ, start_response)]) - -# from webob.dec import wsgify -# @wsgify -# def method_not_allowed_app(req): -# if req.method != 'GET': -# raise HTTPMethodNotAllowed().exception -# return 'hello!' - - -# def test_exception_with_unicode_data(): -# req = Request.blank('/', method=u'POST') -# res = req.get_response(method_not_allowed_app) -# assert res.status_int == 405 - -# def test_WSGIHTTPException_headers(): -# exc = WSGIHTTPException(headers=[('Set-Cookie', 'a=1'), -# ('Set-Cookie', 'a=2')]) -# mixed = exc.headers.mixed() -# assert mixed['set-cookie'] == ['a=1', 'a=2'] - -# def test_WSGIHTTPException_w_body_template(): -# from string import Template -# TEMPLATE = '$foo: $bar' -# exc = WSGIHTTPException(body_template = TEMPLATE) -# assert_equal(exc.body_template, TEMPLATE) -# ok_(isinstance(exc.body_template_obj, Template)) -# eq_(exc.body_template_obj.substitute({'foo': 'FOO', 'bar': 'BAR'}), -# 'FOO: BAR') - -# def test_WSGIHTTPException_w_empty_body(): -# class EmptyOnly(WSGIHTTPException): -# empty_body = True -# exc = EmptyOnly(content_type='text/plain', content_length=234) -# ok_('content_type' not in exc.__dict__) -# ok_('content_length' not in exc.__dict__) - -# def test_WSGIHTTPException___str__(): -# exc1 = WSGIHTTPException(detail='Detail') -# eq_(str(exc1), 'Detail') -# class Explain(WSGIHTTPException): -# explanation = 'Explanation' -# eq_(str(Explain()), 'Explanation') - -# def test_WSGIHTTPException_plain_body_no_comment(): -# class Explain(WSGIHTTPException): -# code = '999' -# title = 'Testing' -# explanation = 'Explanation' -# exc = Explain(detail='Detail') -# eq_(exc.plain_body({}), -# '999 Testing\n\nExplanation\n\n Detail ') - -# def test_WSGIHTTPException_html_body_w_comment(): -# class Explain(WSGIHTTPException): -# code = '999' -# title = 'Testing' -# explanation = 'Explanation' -# exc = Explain(detail='Detail', comment='Comment') -# eq_(exc.html_body({}), -# '\n' -# ' \n' -# ' 999 Testing\n' -# ' \n' -# ' \n' -# '

999 Testing

\n' -# ' Explanation

\n' -# 'Detail\n' -# '\n\n' -# ' \n' -# '' -# ) - -# def test_WSGIHTTPException_generate_response(): -# def start_response(status, headers, exc_info=None): -# pass -# environ = { -# 'wsgi.url_scheme': 'HTTP', -# 'SERVER_NAME': 'localhost', -# 'SERVER_PORT': '80', -# 'REQUEST_METHOD': 'PUT', -# 'HTTP_ACCEPT': 'text/html' -# } -# excep = WSGIHTTPException() -# assert_equal( excep(environ,start_response), [ -# '\n' -# ' \n' -# ' None None\n' -# ' \n' -# ' \n' -# '

None None

\n' -# '

\n' -# '\n' -# '\n\n' -# ' \n' -# '' ] -# ) - -# def test_WSGIHTTPException_call_w_body(): -# def start_response(status, headers, exc_info=None): -# pass -# environ = { -# 'wsgi.url_scheme': 'HTTP', -# 'SERVER_NAME': 'localhost', -# 'SERVER_PORT': '80', -# 'REQUEST_METHOD': 'PUT' -# } -# excep = WSGIHTTPException() -# excep.body = 'test' -# assert_equal( excep(environ,start_response), ['test'] ) - - -# def test_WSGIHTTPException_wsgi_response(): -# def start_response(status, headers, exc_info=None): -# pass -# environ = { -# 'wsgi.url_scheme': 'HTTP', -# 'SERVER_NAME': 'localhost', -# 'SERVER_PORT': '80', -# 'REQUEST_METHOD': 'HEAD' -# } -# excep = WSGIHTTPException() -# assert_equal( excep.wsgi_response(environ,start_response), [] ) - -# def test_WSGIHTTPException_exception_newstyle(): -# def start_response(status, headers, exc_info=None): -# pass -# environ = { -# 'wsgi.url_scheme': 'HTTP', -# 'SERVER_NAME': 'localhost', -# 'SERVER_PORT': '80', -# 'REQUEST_METHOD': 'HEAD' -# } -# excep = WSGIHTTPException() -# exc.newstyle_exceptions = True -# assert_equal( excep.exception(environ,start_response), [] ) - -# def test_WSGIHTTPException_exception_no_newstyle(): -# def start_response(status, headers, exc_info=None): -# pass -# environ = { -# 'wsgi.url_scheme': 'HTTP', -# 'SERVER_NAME': 'localhost', -# 'SERVER_PORT': '80', -# 'REQUEST_METHOD': 'HEAD' -# } -# excep = WSGIHTTPException() -# exc.newstyle_exceptions = False -# assert_equal( excep.exception(environ,start_response), [] ) - -# def test_HTTPMove(): -# def start_response(status, headers, exc_info=None): -# pass -# environ = { -# 'wsgi.url_scheme': 'HTTP', -# 'SERVER_NAME': 'localhost', -# 'SERVER_PORT': '80', -# 'REQUEST_METHOD': 'HEAD' -# } -# m = _HTTPMove() -# assert_equal( m( environ, start_response ), [] ) - -# def test_HTTPMove_location_not_none(): -# def start_response(status, headers, exc_info=None): -# pass -# environ = { -# 'wsgi.url_scheme': 'HTTP', -# 'SERVER_NAME': 'localhost', -# 'SERVER_PORT': '80', -# 'REQUEST_METHOD': 'HEAD' -# } -# m = _HTTPMove(location='http://example.com') -# assert_equal( m( environ, start_response ), [] ) - -# def test_HTTPMove_add_slash_and_location(): -# def start_response(status, headers, exc_info=None): -# pass -# environ = { -# 'wsgi.url_scheme': 'HTTP', -# 'SERVER_NAME': 'localhost', -# 'SERVER_PORT': '80', -# 'REQUEST_METHOD': 'HEAD' -# } -# assert_raises( TypeError, _HTTPMove, location='http://example.com', add_slash=True ) - -# def test_HTTPMove_call_add_slash(): -# def start_response(status, headers, exc_info=None): -# pass -# environ = { -# 'wsgi.url_scheme': 'HTTP', -# 'SERVER_NAME': 'localhost', -# 'SERVER_PORT': '80', -# 'REQUEST_METHOD': 'HEAD' -# } -# m = _HTTPMove() -# m.add_slash = True -# assert_equal( m( environ, start_response ), [] ) - -# def test_HTTPMove_call_query_string(): -# def start_response(status, headers, exc_info=None): -# pass -# environ = { -# 'wsgi.url_scheme': 'HTTP', -# 'SERVER_NAME': 'localhost', -# 'SERVER_PORT': '80', -# 'REQUEST_METHOD': 'HEAD' -# } -# m = _HTTPMove() -# m.add_slash = True -# environ[ 'QUERY_STRING' ] = 'querystring' -# assert_equal( m( environ, start_response ), [] ) - -# def test_HTTPExceptionMiddleware_ok(): -# def app( environ, start_response ): -# return '123' -# application = app -# m = HTTPExceptionMiddleware(application) -# environ = {} -# start_response = None -# res = m( environ, start_response ) -# assert_equal( res, '123' ) - -# def test_HTTPExceptionMiddleware_exception(): -# def wsgi_response( environ, start_response): -# return '123' -# def app( environ, start_response ): -# raise HTTPException( None, wsgi_response ) -# application = app -# m = HTTPExceptionMiddleware(application) -# environ = {} -# start_response = None -# res = m( environ, start_response ) -# assert_equal( res, '123' ) - -# def test_HTTPExceptionMiddleware_exception_exc_info_none(): -# class DummySys: -# def exc_info(self): -# return None -# def wsgi_response( environ, start_response): -# return start_response('200 OK', [], exc_info=None) -# def app( environ, start_response ): -# raise HTTPException( None, wsgi_response ) -# application = app -# m = HTTPExceptionMiddleware(application) -# environ = {} -# def start_response(status, headers, exc_info): -# pass -# try: -# from webob import exc -# old_sys = exc.sys -# sys = DummySys() -# res = m( environ, start_response ) -# assert_equal( res, None ) -# finally: -# exc.sys = old_sys -- cgit v1.2.3