forked from orbit-oss/flask
Fight the generic asserts!
This commit is contained in:
parent
2b830af2ef
commit
3069e2d7f7
8 changed files with 212 additions and 212 deletions
|
|
@ -24,7 +24,7 @@ class TemplatingTestCase(FlaskTestCase):
|
|||
def index():
|
||||
return flask.render_template('context_template.html', value=23)
|
||||
rv = app.test_client().get('/')
|
||||
assert rv.data == '<p>23|42'
|
||||
self.assert_equal(rv.data, '<p>23|42')
|
||||
|
||||
def test_original_win(self):
|
||||
app = flask.Flask(__name__)
|
||||
|
|
@ -32,7 +32,7 @@ class TemplatingTestCase(FlaskTestCase):
|
|||
def index():
|
||||
return flask.render_template_string('{{ config }}', config=42)
|
||||
rv = app.test_client().get('/')
|
||||
assert rv.data == '42'
|
||||
self.assert_equal(rv.data, '42')
|
||||
|
||||
def test_standard_context(self):
|
||||
app = flask.Flask(__name__)
|
||||
|
|
@ -48,7 +48,7 @@ class TemplatingTestCase(FlaskTestCase):
|
|||
{{ session.test }}
|
||||
''')
|
||||
rv = app.test_client().get('/?foo=42')
|
||||
assert rv.data.split() == ['42', '23', 'False', 'aha']
|
||||
self.assert_equal(rv.data.split(), ['42', '23', 'False', 'aha'])
|
||||
|
||||
def test_escaping(self):
|
||||
text = '<p>Hello World!'
|
||||
|
|
@ -58,14 +58,14 @@ class TemplatingTestCase(FlaskTestCase):
|
|||
return flask.render_template('escaping_template.html', text=text,
|
||||
html=flask.Markup(text))
|
||||
lines = app.test_client().get('/').data.splitlines()
|
||||
assert lines == [
|
||||
self.assert_equal(lines, [
|
||||
'<p>Hello World!',
|
||||
'<p>Hello World!',
|
||||
'<p>Hello World!',
|
||||
'<p>Hello World!',
|
||||
'<p>Hello World!',
|
||||
'<p>Hello World!'
|
||||
]
|
||||
])
|
||||
|
||||
def test_no_escaping(self):
|
||||
app = flask.Flask(__name__)
|
||||
|
|
@ -79,7 +79,7 @@ class TemplatingTestCase(FlaskTestCase):
|
|||
app = flask.Flask(__name__)
|
||||
with app.test_request_context():
|
||||
macro = flask.get_template_attribute('_macro.html', 'hello')
|
||||
assert macro('World') == 'Hello World!'
|
||||
self.assert_equal(macro('World'), 'Hello World!')
|
||||
|
||||
def test_template_filter(self):
|
||||
app = flask.Flask(__name__)
|
||||
|
|
@ -87,8 +87,8 @@ class TemplatingTestCase(FlaskTestCase):
|
|||
def my_reverse(s):
|
||||
return s[::-1]
|
||||
assert 'my_reverse' in app.jinja_env.filters.keys()
|
||||
assert app.jinja_env.filters['my_reverse'] == my_reverse
|
||||
assert app.jinja_env.filters['my_reverse']('abcd') == 'dcba'
|
||||
self.assert_equal(app.jinja_env.filters['my_reverse'], my_reverse)
|
||||
self.assert_equal(app.jinja_env.filters['my_reverse']('abcd'), 'dcba')
|
||||
|
||||
def test_template_filter_with_name(self):
|
||||
app = flask.Flask(__name__)
|
||||
|
|
@ -96,8 +96,8 @@ class TemplatingTestCase(FlaskTestCase):
|
|||
def my_reverse(s):
|
||||
return s[::-1]
|
||||
assert 'strrev' in app.jinja_env.filters.keys()
|
||||
assert app.jinja_env.filters['strrev'] == my_reverse
|
||||
assert app.jinja_env.filters['strrev']('abcd') == 'dcba'
|
||||
self.assert_equal(app.jinja_env.filters['strrev'], my_reverse)
|
||||
self.assert_equal(app.jinja_env.filters['strrev']('abcd'), 'dcba')
|
||||
|
||||
def test_template_filter_with_template(self):
|
||||
app = flask.Flask(__name__)
|
||||
|
|
@ -108,7 +108,7 @@ class TemplatingTestCase(FlaskTestCase):
|
|||
def index():
|
||||
return flask.render_template('template_filter.html', value='abcd')
|
||||
rv = app.test_client().get('/')
|
||||
assert rv.data == 'dcba'
|
||||
self.assert_equal(rv.data, 'dcba')
|
||||
|
||||
def test_template_filter_with_name_and_template(self):
|
||||
app = flask.Flask(__name__)
|
||||
|
|
@ -119,7 +119,7 @@ class TemplatingTestCase(FlaskTestCase):
|
|||
def index():
|
||||
return flask.render_template('template_filter.html', value='abcd')
|
||||
rv = app.test_client().get('/')
|
||||
assert rv.data == 'dcba'
|
||||
self.assert_equal(rv.data, 'dcba')
|
||||
|
||||
def test_custom_template_loader(self):
|
||||
class MyFlask(flask.Flask):
|
||||
|
|
@ -132,7 +132,7 @@ class TemplatingTestCase(FlaskTestCase):
|
|||
return flask.render_template('index.html')
|
||||
c = app.test_client()
|
||||
rv = c.get('/')
|
||||
assert rv.data == 'Hello Custom World!'
|
||||
self.assert_equal(rv.data, 'Hello Custom World!')
|
||||
|
||||
|
||||
def suite():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue