replace 1/0 by 1 // 0 to get rid of DeprecationWarning (and PEP8 issue)

This commit is contained in:
Thomas Waldmann 2013-05-26 20:33:22 +02:00
parent 0f5d8c258c
commit ac04bc7836
6 changed files with 13 additions and 13 deletions

View file

@ -529,7 +529,7 @@ class BasicFunctionalityTestCase(FlaskTestCase):
pass pass
@app.route('/') @app.route('/')
def fails(): def fails():
1/0 1 // 0
rv = app.test_client().get('/') rv = app.test_client().get('/')
self.assert_equal(rv.status_code, 500) self.assert_equal(rv.status_code, 500)
self.assert_in(b'Internal Server Error', rv.data) self.assert_in(b'Internal Server Error', rv.data)
@ -866,7 +866,7 @@ class BasicFunctionalityTestCase(FlaskTestCase):
app = flask.Flask(__name__) app = flask.Flask(__name__)
@app.route('/') @app.route('/')
def index(): def index():
1/0 1 // 0
c = app.test_client() c = app.test_client()
if config_key is not None: if config_key is not None:
app.config[config_key] = True app.config[config_key] = True
@ -1054,7 +1054,7 @@ class BasicFunctionalityTestCase(FlaskTestCase):
@app.route('/fail') @app.route('/fail')
def fail_func(): def fail_func():
1/0 1 // 0
c = app.test_client() c = app.test_client()
for x in range(3): for x in range(3):

View file

@ -306,7 +306,7 @@ class LoggingTestCase(FlaskTestCase):
@app.route('/exc') @app.route('/exc')
def exc(): def exc():
1/0 1 // 0
with app.test_client() as c: with app.test_client() as c:
with catch_stderr() as err: with catch_stderr() as err:
@ -340,7 +340,7 @@ class LoggingTestCase(FlaskTestCase):
@app.route('/') @app.route('/')
def index(): def index():
1/0 1 // 0
rv = app.test_client().get('/') rv = app.test_client().get('/')
self.assert_equal(rv.status_code, 500) self.assert_equal(rv.status_code, 500)
@ -349,7 +349,7 @@ class LoggingTestCase(FlaskTestCase):
err = out.getvalue() err = out.getvalue()
self.assert_in('Exception on / [GET]', err) self.assert_in('Exception on / [GET]', err)
self.assert_in('Traceback (most recent call last):', err) self.assert_in('Traceback (most recent call last):', err)
self.assert_in('1/0', err) self.assert_in('1 // 0', err)
self.assert_in('ZeroDivisionError:', err) self.assert_in('ZeroDivisionError:', err)
def test_processor_exceptions(self): def test_processor_exceptions(self):
@ -357,11 +357,11 @@ class LoggingTestCase(FlaskTestCase):
@app.before_request @app.before_request
def before_request(): def before_request():
if trigger == 'before': if trigger == 'before':
1/0 1 // 0
@app.after_request @app.after_request
def after_request(response): def after_request(response):
if trigger == 'after': if trigger == 'after':
1/0 1 // 0
return response return response
@app.route('/') @app.route('/')
def index(): def index():

View file

@ -83,7 +83,7 @@ class SignalsTestCase(FlaskTestCase):
@app.route('/') @app.route('/')
def index(): def index():
1/0 1 // 0
def record(sender, exception): def record(sender, exception):
recorded.append(exception) recorded.append(exception)

View file

@ -30,7 +30,7 @@ class FlaskSubclassingTestCase(FlaskTestCase):
@app.route('/') @app.route('/')
def index(): def index():
1/0 1 // 0
rv = app.test_client().get('/') rv = app.test_client().get('/')
self.assert_equal(rv.status_code, 500) self.assert_equal(rv.status_code, 500)

View file

@ -143,7 +143,7 @@ class TestToolsTestCase(FlaskTestCase):
@app.route('/other') @app.route('/other')
def other(): def other():
1/0 1 // 0
with app.test_client() as c: with app.test_client() as c:
resp = c.get('/') resp = c.get('/')

View file

@ -55,9 +55,9 @@ class ViewTestCase(FlaskTestCase):
class Index(flask.views.MethodView): class Index(flask.views.MethodView):
def get(self): def get(self):
1/0 1 // 0
def post(self): def post(self):
1/0 1 // 0
class Other(Index): class Other(Index):
def get(self): def get(self):