Use assert_true instead of assert_

assert_ is deprecated which causes annoying warnings
This commit is contained in:
Daniel Neuhäuser 2013-05-22 17:23:38 +02:00
parent 5b89355b1c
commit 239780be28
12 changed files with 147 additions and 144 deletions

View file

@ -28,7 +28,7 @@ class ConfigTestCase(FlaskTestCase):
def common_object_test(self, app):
self.assert_equal(app.secret_key, 'devkey')
self.assert_equal(app.config['TEST_KEY'], 'foo')
self.assert_('ConfigTestCase' not in app.config)
self.assert_true('ConfigTestCase' not in app.config)
def test_config_from_file(self):
app = flask.Flask(__name__)
@ -57,13 +57,13 @@ class ConfigTestCase(FlaskTestCase):
try:
app.config.from_envvar('FOO_SETTINGS')
except RuntimeError as e:
self.assert_("'FOO_SETTINGS' is not set" in str(e))
self.assert_true("'FOO_SETTINGS' is not set" in str(e))
else:
self.assert_(0, 'expected exception')
self.assert_(not app.config.from_envvar('FOO_SETTINGS', silent=True))
self.assert_true(0, 'expected exception')
self.assert_true(not app.config.from_envvar('FOO_SETTINGS', silent=True))
os.environ = {'FOO_SETTINGS': __file__.rsplit('.', 1)[0] + '.py'}
self.assert_(app.config.from_envvar('FOO_SETTINGS'))
self.assert_true(app.config.from_envvar('FOO_SETTINGS'))
self.common_object_test(app)
finally:
os.environ = env
@ -77,9 +77,9 @@ class ConfigTestCase(FlaskTestCase):
app.config.from_envvar('FOO_SETTINGS')
except IOError as e:
msg = str(e)
self.assert_(msg.startswith('[Errno 2] Unable to load configuration '
self.assert_true(msg.startswith('[Errno 2] Unable to load configuration '
'file (No such file or directory):'))
self.assert_(msg.endswith("missing.cfg'"))
self.assert_true(msg.endswith("missing.cfg'"))
else:
self.fail('expected IOError')
self.assertFalse(app.config.from_envvar('FOO_SETTINGS', silent=True))
@ -92,12 +92,12 @@ class ConfigTestCase(FlaskTestCase):
app.config.from_pyfile('missing.cfg')
except IOError as e:
msg = str(e)
self.assert_(msg.startswith('[Errno 2] Unable to load configuration '
self.assert_true(msg.startswith('[Errno 2] Unable to load configuration '
'file (No such file or directory):'))
self.assert_(msg.endswith("missing.cfg'"))
self.assert_true(msg.endswith("missing.cfg'"))
else:
self.assert_(0, 'expected config')
self.assert_(not app.config.from_pyfile('missing.cfg', silent=True))
self.assert_true(0, 'expected config')
self.assert_true(not app.config.from_pyfile('missing.cfg', silent=True))
def test_session_lifetime(self):
app = flask.Flask(__name__)
@ -141,7 +141,7 @@ class InstanceTestCase(FlaskTestCase):
try:
flask.Flask(__name__, instance_path='instance')
except ValueError as e:
self.assert_('must be absolute' in str(e))
self.assert_true('must be absolute' in str(e))
else:
self.fail('Expected value error')