Permalink
Browse files

replace deprecated assert functions

  • Loading branch information...
puzzlet committed Nov 24, 2012
1 parent 690703b commit d6fb580e847407662ebb6c9c5b8775e986d36111
Showing with 29 additions and 29 deletions.
  1. +13 −13 flask/testsuite/blueprints.py
  2. +12 −12 flask/testsuite/templating.py
  3. +4 −4 flask/testsuite/testing.py
@@ -657,9 +657,9 @@ def is_boolean(value):
return isinstance(value, bool)
app = flask.Flask(__name__)
app.register_blueprint(bp, url_prefix='/py')
- self.assert_('is_boolean' in app.jinja_env.tests.keys())
+ self.assertTrue('is_boolean' in app.jinja_env.tests.keys())
self.assert_equal(app.jinja_env.tests['is_boolean'], is_boolean)
- self.assert_(app.jinja_env.tests['is_boolean'](False))
+ self.assertTrue(app.jinja_env.tests['is_boolean'](False))
def test_add_template_test(self):
bp = flask.Blueprint('bp', __name__)
@@ -668,9 +668,9 @@ def is_boolean(value):
bp.add_app_template_test(is_boolean)
app = flask.Flask(__name__)
app.register_blueprint(bp, url_prefix='/py')
- self.assert_('is_boolean' in app.jinja_env.tests.keys())
+ self.assertTrue('is_boolean' in app.jinja_env.tests.keys())
self.assert_equal(app.jinja_env.tests['is_boolean'], is_boolean)
- self.assert_(app.jinja_env.tests['is_boolean'](False))
+ self.assertTrue(app.jinja_env.tests['is_boolean'](False))
def test_template_test_with_name(self):
bp = flask.Blueprint('bp', __name__)
@@ -679,9 +679,9 @@ def is_boolean(value):
return isinstance(value, bool)
app = flask.Flask(__name__)
app.register_blueprint(bp, url_prefix='/py')
- self.assert_('boolean' in app.jinja_env.tests.keys())
+ self.assertTrue('boolean' in app.jinja_env.tests.keys())
self.assert_equal(app.jinja_env.tests['boolean'], is_boolean)
- self.assert_(app.jinja_env.tests['boolean'](False))
+ self.assertTrue(app.jinja_env.tests['boolean'](False))
def test_add_template_test_with_name(self):
bp = flask.Blueprint('bp', __name__)
@@ -690,9 +690,9 @@ def is_boolean(value):
bp.add_app_template_test(is_boolean, 'boolean')
app = flask.Flask(__name__)
app.register_blueprint(bp, url_prefix='/py')
- self.assert_('boolean' in app.jinja_env.tests.keys())
+ self.assertTrue('boolean' in app.jinja_env.tests.keys())
self.assert_equal(app.jinja_env.tests['boolean'], is_boolean)
- self.assert_(app.jinja_env.tests['boolean'](False))
+ self.assertTrue(app.jinja_env.tests['boolean'](False))
def test_template_test_with_template(self):
bp = flask.Blueprint('bp', __name__)
@@ -705,7 +705,7 @@ def boolean(value):
def index():
return flask.render_template('template_test.html', value=False)
rv = app.test_client().get('/')
- self.assert_(b'Success!' in rv.data)
+ self.assertTrue(b'Success!' in rv.data)
def test_template_test_after_route_with_template(self):
app = flask.Flask(__name__)
@@ -718,7 +718,7 @@ def boolean(value):
return isinstance(value, bool)
app.register_blueprint(bp, url_prefix='/py')
rv = app.test_client().get('/')
- self.assert_(b'Success!' in rv.data)
+ self.assertTrue(b'Success!' in rv.data)
def test_add_template_test_with_template(self):
bp = flask.Blueprint('bp', __name__)
@@ -731,7 +731,7 @@ def boolean(value):
def index():
return flask.render_template('template_test.html', value=False)
rv = app.test_client().get('/')
- self.assert_(b'Success!' in rv.data)
+ self.assertTrue(b'Success!' in rv.data)
def test_template_test_with_name_and_template(self):
bp = flask.Blueprint('bp', __name__)
@@ -744,7 +744,7 @@ def is_boolean(value):
def index():
return flask.render_template('template_test.html', value=False)
rv = app.test_client().get('/')
- self.assert_(b'Success!' in rv.data)
+ self.assertTrue(b'Success!' in rv.data)
def test_add_template_test_with_name_and_template(self):
bp = flask.Blueprint('bp', __name__)
@@ -757,7 +757,7 @@ def is_boolean(value):
def index():
return flask.render_template('template_test.html', value=False)
rv = app.test_client().get('/')
- self.assert_(b'Success!' in rv.data)
+ self.assertTrue(b'Success!' in rv.data)
def suite():
suite = unittest.TestSuite()
@@ -181,36 +181,36 @@ def test_template_test(self):
@app.template_test()
def boolean(value):
return isinstance(value, bool)
- self.assert_('boolean' in app.jinja_env.tests.keys())
+ self.assertTrue('boolean' in app.jinja_env.tests.keys())
self.assert_equal(app.jinja_env.tests['boolean'], boolean)
- self.assert_(app.jinja_env.tests['boolean'](False))
+ self.assertTrue(app.jinja_env.tests['boolean'](False))
def test_add_template_test(self):
app = flask.Flask(__name__)
def boolean(value):
return isinstance(value, bool)
app.add_template_test(boolean)
- self.assert_('boolean' in app.jinja_env.tests.keys())
+ self.assertTrue('boolean' in app.jinja_env.tests.keys())
self.assert_equal(app.jinja_env.tests['boolean'], boolean)
- self.assert_(app.jinja_env.tests['boolean'](False))
+ self.assertTrue(app.jinja_env.tests['boolean'](False))
def test_template_test_with_name(self):
app = flask.Flask(__name__)
@app.template_test('boolean')
def is_boolean(value):
return isinstance(value, bool)
- self.assert_('boolean' in app.jinja_env.tests.keys())
+ self.assertTrue('boolean' in app.jinja_env.tests.keys())
self.assert_equal(app.jinja_env.tests['boolean'], is_boolean)
- self.assert_(app.jinja_env.tests['boolean'](False))
+ self.assertTrue(app.jinja_env.tests['boolean'](False))
def test_add_template_test_with_name(self):
app = flask.Flask(__name__)
def is_boolean(value):
return isinstance(value, bool)
app.add_template_test(is_boolean, 'boolean')
- self.assert_('boolean' in app.jinja_env.tests.keys())
+ self.assertTrue('boolean' in app.jinja_env.tests.keys())
self.assert_equal(app.jinja_env.tests['boolean'], is_boolean)
- self.assert_(app.jinja_env.tests['boolean'](False))
+ self.assertTrue(app.jinja_env.tests['boolean'](False))
def test_template_test_with_template(self):
app = flask.Flask(__name__)
@@ -221,7 +221,7 @@ def boolean(value):
def index():
return flask.render_template('template_test.html', value=False)
rv = app.test_client().get('/')
- self.assert_(b'Success!' in rv.data)
+ self.assertTrue(b'Success!' in rv.data)
def test_add_template_test_with_template(self):
app = flask.Flask(__name__)
@@ -232,7 +232,7 @@ def boolean(value):
def index():
return flask.render_template('template_test.html', value=False)
rv = app.test_client().get('/')
- self.assert_(b'Success!' in rv.data)
+ self.assertTrue(b'Success!' in rv.data)
def test_template_test_with_name_and_template(self):
app = flask.Flask(__name__)
@@ -243,7 +243,7 @@ def is_boolean(value):
def index():
return flask.render_template('template_test.html', value=False)
rv = app.test_client().get('/')
- self.assert_(b'Success!' in rv.data)
+ self.assertTrue(b'Success!' in rv.data)
def test_add_template_test_with_name_and_template(self):
app = flask.Flask(__name__)
@@ -254,7 +254,7 @@ def is_boolean(value):
def index():
return flask.render_template('template_test.html', value=False)
rv = app.test_client().get('/')
- self.assert_(b'Success!' in rv.data)
+ self.assertTrue(b'Success!' in rv.data)
def test_custom_template_loader(self):
class MyFlask(flask.Flask):
@@ -220,8 +220,8 @@ def view(company_id):
url = flask.url_for('view', company_id='xxx')
response = self.client.get(url)
- self.assertEquals(200, response.status_code)
- self.assertEquals(b'xxx', response.data)
+ self.assertEqual(200, response.status_code)
+ self.assertEqual(b'xxx', response.data)
def test_nosubdomain(self):
@@ -232,8 +232,8 @@ def view(company_id):
url = flask.url_for('view', company_id='xxx')
response = self.client.get(url)
- self.assertEquals(200, response.status_code)
- self.assertEquals(b'xxx', response.data)
+ self.assertEqual(200, response.status_code)
+ self.assertEqual(b'xxx', response.data)
def suite():

0 comments on commit d6fb580

Please sign in to comment.