forked from orbit-oss/flask
Merge pull request #743 from ThomasWaldmann/sprint-branch
fix iterator in testsuite helpers
This commit is contained in:
commit
3c5d7bab26
1 changed files with 3 additions and 2 deletions
|
|
@ -15,7 +15,7 @@ import unittest
|
||||||
from logging import StreamHandler
|
from logging import StreamHandler
|
||||||
from flask.testsuite import FlaskTestCase, catch_warnings, catch_stderr
|
from flask.testsuite import FlaskTestCase, catch_warnings, catch_stderr
|
||||||
from werkzeug.http import parse_cache_control_header, parse_options_header
|
from werkzeug.http import parse_cache_control_header, parse_options_header
|
||||||
from flask._compat import StringIO, text_type
|
from flask._compat import StringIO, text_type, implements_iterator
|
||||||
|
|
||||||
|
|
||||||
def has_encoding(name):
|
def has_encoding(name):
|
||||||
|
|
@ -485,6 +485,7 @@ class StreamingTestCase(FlaskTestCase):
|
||||||
app = flask.Flask(__name__)
|
app = flask.Flask(__name__)
|
||||||
app.testing = True
|
app.testing = True
|
||||||
called = []
|
called = []
|
||||||
|
@implements_iterator
|
||||||
class Wrapper(object):
|
class Wrapper(object):
|
||||||
def __init__(self, gen):
|
def __init__(self, gen):
|
||||||
self._gen = gen
|
self._gen = gen
|
||||||
|
|
@ -492,7 +493,7 @@ class StreamingTestCase(FlaskTestCase):
|
||||||
return self
|
return self
|
||||||
def close(self):
|
def close(self):
|
||||||
called.append(42)
|
called.append(42)
|
||||||
def next(self):
|
def __next__(self):
|
||||||
return next(self._gen)
|
return next(self._gen)
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue