Changed assert to self.assert_ where it was still in place

This commit is contained in:
Armin Ronacher 2011-08-26 11:43:27 +01:00
parent 3069e2d7f7
commit fc2caa4b9c
8 changed files with 86 additions and 86 deletions

View file

@ -108,7 +108,7 @@ class SendfileTestCase(FlaskTestCase):
app = flask.Flask(__name__)
with app.test_request_context():
rv = flask.send_file('static/index.html')
assert rv.direct_passthrough
self.assert_(rv.direct_passthrough)
self.assert_equal(rv.mimetype, 'text/html')
with app.open_resource('static/index.html') as f:
self.assert_equal(rv.data, f.read())
@ -118,8 +118,8 @@ class SendfileTestCase(FlaskTestCase):
app.use_x_sendfile = True
with app.test_request_context():
rv = flask.send_file('static/index.html')
assert rv.direct_passthrough
assert 'x-sendfile' in rv.headers
self.assert_(rv.direct_passthrough)
self.assert_('x-sendfile' in rv.headers)
self.assert_equal(rv.headers['x-sendfile'],
os.path.join(app.root_path, 'static/index.html'))
self.assert_equal(rv.mimetype, 'text/html')
@ -142,7 +142,7 @@ class SendfileTestCase(FlaskTestCase):
f = open(os.path.join(app.root_path, 'static/index.html'))
rv = flask.send_file(f)
self.assert_equal(rv.mimetype, 'text/html')
assert 'x-sendfile' in rv.headers
self.assert_('x-sendfile' in rv.headers)
self.assert_equal(rv.headers['x-sendfile'],
os.path.join(app.root_path, 'static/index.html'))
# mimetypes + etag
@ -170,7 +170,7 @@ class SendfileTestCase(FlaskTestCase):
with app.test_request_context():
f = StringIO('Test')
rv = flask.send_file(f)
assert 'x-sendfile' not in rv.headers
self.assert_('x-sendfile' not in rv.headers)
# etags
self.assert_equal(len(captured), 1)
@ -207,10 +207,10 @@ class LoggingTestCase(FlaskTestCase):
def test_logger_cache(self):
app = flask.Flask(__name__)
logger1 = app.logger
assert app.logger is logger1
self.assert_(app.logger is logger1)
self.assert_equal(logger1.name, __name__)
app.logger_name = __name__ + '/test_logger_cache'
assert app.logger is not logger1
self.assert_(app.logger is not logger1)
def test_debug_log(self):
app = flask.Flask(__name__)
@ -230,10 +230,10 @@ class LoggingTestCase(FlaskTestCase):
with catch_stderr() as err:
c.get('/')
out = err.getvalue()
assert 'WARNING in helpers [' in out
assert os.path.basename(__file__.rsplit('.')[0] + '.py') in out
assert 'the standard library is dead' in out
assert 'this is a debug statement' in out
self.assert_('WARNING in helpers [' in out)
self.assert_(os.path.basename(__file__.rsplit('.')[0] + '.py') in out)
self.assert_('the standard library is dead' in out)
self.assert_('this is a debug statement' in out)
with catch_stderr() as err:
try:
@ -241,7 +241,7 @@ class LoggingTestCase(FlaskTestCase):
except ZeroDivisionError:
pass
else:
assert False, 'debug log ate the exception'
self.assert_(False, 'debug log ate the exception')
def test_exception_logging(self):
out = StringIO()
@ -255,13 +255,13 @@ class LoggingTestCase(FlaskTestCase):
rv = app.test_client().get('/')
self.assert_equal(rv.status_code, 500)
assert 'Internal Server Error' in rv.data
self.assert_('Internal Server Error' in rv.data)
err = out.getvalue()
assert 'Exception on / [GET]' in err
assert 'Traceback (most recent call last):' in err
assert '1/0' in err
assert 'ZeroDivisionError:' in err
self.assert_('Exception on / [GET]' in err)
self.assert_('Traceback (most recent call last):' in err)
self.assert_('1/0' in err)
self.assert_('ZeroDivisionError:' in err)
def test_processor_exceptions(self):
app = flask.Flask(__name__)