Skip to content
Myr

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

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Thomas Waldmann · committed by Thomas Waldmann · parent 0f5d8c2 · Browse files · 6 files+13 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

6 files+13 added−13 removed

  • other:+13 added−13 removed

6 files+13 added−13 removed

modified:flask/testsuite/basic.py+3 added-3 removed
527 unmodified lines
528 except:529 pass530 @app.route('/')531 def fails():532 1/0532 1 // 0533 rv = app.test_client().get('/')534 self.assert_equal(rv.status_code, 500)535 self.assert_in(b'Internal Server Error', rv.data)536 self.assert_equal(len(called), 2)
328 unmodified lines
865 def apprunner(configkey):866 app = flask.Flask(__name__)867 @app.route('/')868 def index():869 1/0869 1 // 0870 c = app.test_client()871 if config_key is not None:872 app.config[config_key] = True873 try:
179 unmodified lines
1053 app.debug = True10541055 @app.route('/fail')1056 def fail_func():1057 1/01057 1 // 010581059 c = app.test_client()1060 for x in range(3):1061 with self.assert_raises(ZeroDivisionError):
89 unmodified lines
modified:flask/testsuite/helpers.py+5 added-5 removed
304 unmodified lines
305 return ''306307 @app.route('/exc')308 def exc():309 1/0309 1 // 0310311 with app.test_client() as c:312 with catch_stderr() as err:313 c.get('/')
25 unmodified lines
339 app.logger.addHandler(StreamHandler(out))340341 @app.route('/')342 def index():343 1/0343 1 // 0344345 rv = app.test_client().get('/')346 self.assert_equal(rv.status_code, 500)347 self.assert_in(b'Internal Server Error', rv.data)348349 err = out.getvalue()350 self.assert_in('Exception on / [GET]', err)351 self.assert_in('Traceback (most recent call last):', err)352 self.assert_in('1/0', err)352 self.assert_in('1 // 0', err)353 self.assert_in('ZeroDivisionError:', err)354355 def test_processor_exceptions(self):356 app = flask.Flask(__name__)357 @app.before_request358 def before_request():359 if trigger == 'before':360 1/0360 1 // 0361 @app.after_request362 def after_request(response):363 if trigger == 'after':364 1/0364 1 // 0365 return response366 @app.route('/')367 def index():368 return 'Foo'
152 unmodified lines
modified:flask/testsuite/signals.py+1 added-1 removed
81 unmodified lines
82 recorded = []8384 @app.route('/')85 def index():86 1/086 1 // 08788 def record(sender, exception):89 recorded.append(exception)90
39 unmodified lines
modified:flask/testsuite/subclassing.py+1 added-1 removed
28 unmodified lines
29 app.logger.addHandler(StreamHandler(out))3031 @app.route('/')32 def index():33 1/033 1 // 03435 rv = app.test_client().get('/')36 self.assert_equal(rv.status_code, 500)37 self.assert_in(b'Internal Server Error', rv.data)
9 unmodified lines
modified:flask/testsuite/testing.py+1 added-1 removed
141 unmodified lines
142 return 'Hello World!'143144 @app.route('/other')145 def other():146 1/0146 1 // 0147148 with app.test_client() as c:149 resp = c.get('/')150 self.assert_equal(flask.g.value, 42)
92 unmodified lines
modified:flask/testsuite/views.py+2 added-2 removed
53 unmodified lines
54 app = flask.Flask(__name__)5556 class Index(flask.views.MethodView):57 def get(self):58 1/058 1 // 059 def post(self):60 1/060 1 // 06162 class Other(Index):63 def get(self):64 return 'GET'
105 unmodified lines