<s> """<STR_LIT>""" <EOL> import pytest <EOL> import flask <EOL> from flask . _compat import text_type <EOL> from werkzeug . http import parse_cache_control_header <EOL> from jinja2 import TemplateNotFound <EOL> def test_blueprint_specific_error_handling ( ) : <EOL> frontend = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> backend = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> sideend = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> @ frontend . errorhandler ( <NUM_LIT> ) <EOL> def frontend_forbidden ( e ) : <EOL> return '<STR_LIT>' , <NUM_LIT> <EOL> @ frontend . route ( '<STR_LIT>' ) <EOL> def frontend_no ( ) : <EOL> flask . abort ( <NUM_LIT> ) <EOL> @ backend . errorhandler ( <NUM_LIT> ) <EOL> def backend_forbidden ( e ) : <EOL> return '<STR_LIT>' , <NUM_LIT> <EOL> @ backend . route ( '<STR_LIT>' ) <EOL> def backend_no ( ) : <EOL> flask . abort ( <NUM_LIT> ) <EOL> @ sideend . route ( '<STR_LIT>' ) <EOL> def sideend_no ( ) : <EOL> flask . abort ( <NUM_LIT> ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( frontend ) <EOL> app . register_blueprint ( backend ) <EOL> app . register_blueprint ( sideend ) <EOL> @ app . errorhandler ( <NUM_LIT> ) <EOL> def app_forbidden ( e ) : <EOL> return '<STR_LIT>' , <NUM_LIT> <EOL> c = app . test_client ( ) <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT>' <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT>' <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT>' <EOL> def test_blueprint_specific_user_error_handling ( ) : <EOL> class MyDecoratorException ( Exception ) : <EOL> pass <EOL> class MyFunctionException ( Exception ) : <EOL> pass <EOL> blue = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> @ blue . errorhandler ( MyDecoratorException ) <EOL> def my_decorator_exception_handler ( e ) : <EOL> assert isinstance ( e , MyDecoratorException ) <EOL> return '<STR_LIT>' <EOL> def my_function_exception_handler ( e ) : <EOL> assert isinstance ( e , MyFunctionException ) <EOL> return '<STR_LIT>' <EOL> blue . register_error_handler ( MyFunctionException , my_function_exception_handler ) <EOL> @ blue . route ( '<STR_LIT>' ) <EOL> def blue_deco_test ( ) : <EOL> raise MyDecoratorException ( ) <EOL> @ blue . route ( '<STR_LIT>' ) <EOL> def blue_func_test ( ) : <EOL> raise MyFunctionException ( ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( blue ) <EOL> c = app . test_client ( ) <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT>' <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT>' <EOL> def test_blueprint_url_definitions ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT:test>' , __name__ ) <EOL> @ bp . route ( '<STR_LIT>' , defaults = { '<STR_LIT>' : <NUM_LIT> } ) <EOL> def foo ( bar , baz ) : <EOL> return '<STR_LIT>' % ( bar , baz ) <EOL> @ bp . route ( '<STR_LIT>' ) <EOL> def bar ( bar ) : <EOL> return text_type ( bar ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' , url_defaults = { '<STR_LIT:bar>' : <NUM_LIT> } ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' , url_defaults = { '<STR_LIT:bar>' : <NUM_LIT> } ) <EOL> c = app . test_client ( ) <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT>' <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT>' <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT>' <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT>' <EOL> def test_blueprint_url_processors ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ , url_prefix = '<STR_LIT>' ) <EOL> @ bp . url_defaults <EOL> def add_language_code ( endpoint , values ) : <EOL> values . setdefault ( '<STR_LIT>' , flask . g . lang_code ) <EOL> @ bp . url_value_preprocessor <EOL> def pull_lang_code ( endpoint , values ) : <EOL> flask . g . lang_code = values . pop ( '<STR_LIT>' ) <EOL> @ bp . route ( '<STR_LIT:/>' ) <EOL> def index ( ) : <EOL> return flask . url_for ( '<STR_LIT>' ) <EOL> @ bp . route ( '<STR_LIT>' ) <EOL> def about ( ) : <EOL> return flask . url_for ( '<STR_LIT>' ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp ) <EOL> c = app . test_client ( ) <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT>' <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT>' <EOL> def test_templates_and_static ( test_apps ) : <EOL> from blueprintapp import app <EOL> c = app . test_client ( ) <EOL> rv = c . get ( '<STR_LIT:/>' ) <EOL> assert rv . data == b'<STR_LIT>' <EOL> rv = c . get ( '<STR_LIT>' ) <EOL> assert rv . data == b'<STR_LIT>' <EOL> rv = c . get ( '<STR_LIT>' ) <EOL> assert rv . data == b'<STR_LIT>' <EOL> rv = c . get ( '<STR_LIT>' ) <EOL> assert rv . data . strip ( ) == b'<STR_LIT>' <EOL> rv . close ( ) <EOL> rv = c . get ( '<STR_LIT>' ) <EOL> assert rv . data . strip ( ) == b'<STR_LIT>' <EOL> rv . close ( ) <EOL> max_age_default = app . config [ '<STR_LIT>' ] <EOL> try : <EOL> expected_max_age = <NUM_LIT> <EOL> if app . config [ '<STR_LIT>' ] == expected_max_age : <EOL> expected_max_age = <NUM_LIT> <EOL> app . config [ '<STR_LIT>' ] = expected_max_age <EOL> rv = c . get ( '<STR_LIT>' ) <EOL> cc = parse_cache_control_header ( rv . headers [ '<STR_LIT>' ] ) <EOL> assert cc . max_age == expected_max_age <EOL> rv . close ( ) <EOL> finally : <EOL> app . config [ '<STR_LIT>' ] = max_age_default <EOL> with app . test_request_context ( ) : <EOL> assert flask . url_for ( '<STR_LIT>' , filename = '<STR_LIT>' ) == '<STR_LIT>' <EOL> with app . test_request_context ( ) : <EOL> with pytest . raises ( TemplateNotFound ) as e : <EOL> flask . render_template ( '<STR_LIT>' ) <EOL> assert e . value . name == '<STR_LIT>' <EOL> with flask . Flask ( __name__ ) . test_request_context ( ) : <EOL> assert flask . render_template ( '<STR_LIT>' ) == '<STR_LIT>' <EOL> def test_default_static_cache_timeout ( ) : <EOL> app = flask . Flask ( __name__ ) <EOL> class MyBlueprint ( flask . Blueprint ) : <EOL> def get_send_file_max_age ( self , filename ) : <EOL> return <NUM_LIT:100> <EOL> blueprint = MyBlueprint ( '<STR_LIT>' , __name__ , static_folder = '<STR_LIT>' ) <EOL> app . register_blueprint ( blueprint ) <EOL> max_age_default = app . config [ '<STR_LIT>' ] <EOL> try : <EOL> with app . test_request_context ( ) : <EOL> unexpected_max_age = <NUM_LIT> <EOL> if app . config [ '<STR_LIT>' ] == unexpected_max_age : <EOL> unexpected_max_age = <NUM_LIT> <EOL> app . config [ '<STR_LIT>' ] = unexpected_max_age <EOL> rv = blueprint . send_static_file ( '<STR_LIT>' ) <EOL> cc = parse_cache_control_header ( rv . headers [ '<STR_LIT>' ] ) <EOL> assert cc . max_age == <NUM_LIT:100> <EOL> rv . close ( ) <EOL> finally : <EOL> app . config [ '<STR_LIT>' ] = max_age_default <EOL> def test_templates_list ( test_apps ) : <EOL> from blueprintapp import app <EOL> templates = sorted ( app . jinja_env . list_templates ( ) ) <EOL> assert templates == [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> def test_dotted_names ( ) : <EOL> frontend = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> backend = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> @ frontend . route ( '<STR_LIT>' ) <EOL> def frontend_index ( ) : <EOL> return flask . url_for ( '<STR_LIT>' ) <EOL> @ frontend . route ( '<STR_LIT>' ) <EOL> def frontend_page2 ( ) : <EOL> return flask . url_for ( '<STR_LIT>' ) <EOL> @ backend . route ( '<STR_LIT>' ) <EOL> def backend_index ( ) : <EOL> return flask . url_for ( '<STR_LIT>' ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( frontend ) <EOL> app . register_blueprint ( backend ) <EOL> c = app . test_client ( ) <EOL> assert c . get ( '<STR_LIT>' ) . data . strip ( ) == b'<STR_LIT>' <EOL> assert c . get ( '<STR_LIT>' ) . data . strip ( ) == b'<STR_LIT>' <EOL> assert c . get ( '<STR_LIT>' ) . data . strip ( ) == b'<STR_LIT>' <EOL> def test_dotted_names_from_app ( ) : <EOL> app = flask . Flask ( __name__ ) <EOL> app . testing = True <EOL> test = flask . Blueprint ( '<STR_LIT:test>' , __name__ ) <EOL> @ app . route ( '<STR_LIT:/>' ) <EOL> def app_index ( ) : <EOL> return flask . url_for ( '<STR_LIT>' ) <EOL> @ test . route ( '<STR_LIT>' ) <EOL> def index ( ) : <EOL> return flask . url_for ( '<STR_LIT>' ) <EOL> app . register_blueprint ( test ) <EOL> with app . test_client ( ) as c : <EOL> rv = c . get ( '<STR_LIT:/>' ) <EOL> assert rv . data == b'<STR_LIT>' <EOL> def test_empty_url_defaults ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> @ bp . route ( '<STR_LIT:/>' , defaults = { '<STR_LIT>' : <NUM_LIT:1> } ) <EOL> @ bp . route ( '<STR_LIT>' ) <EOL> def something ( page ) : <EOL> return str ( page ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp ) <EOL> c = app . test_client ( ) <EOL> assert c . get ( '<STR_LIT:/>' ) . data == b'<STR_LIT:1>' <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT:2>' <EOL> def test_route_decorator_custom_endpoint ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> @ bp . route ( '<STR_LIT>' ) <EOL> def foo ( ) : <EOL> return flask . request . endpoint <EOL> @ bp . route ( '<STR_LIT>' , endpoint = '<STR_LIT:bar>' ) <EOL> def foo_bar ( ) : <EOL> return flask . request . endpoint <EOL> @ bp . route ( '<STR_LIT>' , endpoint = '<STR_LIT>' ) <EOL> def foo_bar_foo ( ) : <EOL> return flask . request . endpoint <EOL> @ bp . route ( '<STR_LIT>' ) <EOL> def bar_foo ( ) : <EOL> return flask . request . endpoint <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> @ app . route ( '<STR_LIT:/>' ) <EOL> def index ( ) : <EOL> return flask . request . endpoint <EOL> c = app . test_client ( ) <EOL> assert c . get ( '<STR_LIT:/>' ) . data == b'<STR_LIT:index>' <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT>' <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT>' <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT>' <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT>' <EOL> def test_route_decorator_custom_endpoint_with_dots ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> @ bp . route ( '<STR_LIT>' ) <EOL> def foo ( ) : <EOL> return flask . request . endpoint <EOL> try : <EOL> @ bp . route ( '<STR_LIT>' , endpoint = '<STR_LIT>' ) <EOL> def foo_bar ( ) : <EOL> return flask . request . endpoint <EOL> except AssertionError : <EOL> pass <EOL> else : <EOL> raise AssertionError ( '<STR_LIT>' ) <EOL> try : <EOL> @ bp . route ( '<STR_LIT>' , endpoint = '<STR_LIT>' ) <EOL> def foo_bar_foo ( ) : <EOL> return flask . request . endpoint <EOL> except AssertionError : <EOL> pass <EOL> else : <EOL> raise AssertionError ( '<STR_LIT>' ) <EOL> def foo_foo_foo ( ) : <EOL> pass <EOL> pytest . raises ( <EOL> AssertionError , <EOL> lambda : bp . add_url_rule ( <EOL> '<STR_LIT>' , endpoint = '<STR_LIT>' , view_func = foo_foo_foo <EOL> ) <EOL> ) <EOL> pytest . raises ( <EOL> AssertionError , <EOL> bp . route ( '<STR_LIT>' , endpoint = '<STR_LIT>' ) , <EOL> lambda : None <EOL> ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> c = app . test_client ( ) <EOL> assert c . get ( '<STR_LIT>' ) . data == b'<STR_LIT>' <EOL> rv = c . get ( '<STR_LIT>' ) <EOL> assert rv . status_code == <NUM_LIT> <EOL> rv = c . get ( '<STR_LIT>' ) <EOL> assert rv . status_code == <NUM_LIT> <EOL> def test_template_filter ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> @ bp . app_template_filter ( ) <EOL> def my_reverse ( s ) : <EOL> return s [ : : - <NUM_LIT:1> ] <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> assert '<STR_LIT>' in app . jinja_env . filters . keys ( ) <EOL> assert app . jinja_env . filters [ '<STR_LIT>' ] == my_reverse <EOL> assert app . jinja_env . filters [ '<STR_LIT>' ] ( '<STR_LIT>' ) == '<STR_LIT>' <EOL> def test_add_template_filter ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> def my_reverse ( s ) : <EOL> return s [ : : - <NUM_LIT:1> ] <EOL> bp . add_app_template_filter ( my_reverse ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> assert '<STR_LIT>' in app . jinja_env . filters . keys ( ) <EOL> assert app . jinja_env . filters [ '<STR_LIT>' ] == my_reverse <EOL> assert app . jinja_env . filters [ '<STR_LIT>' ] ( '<STR_LIT>' ) == '<STR_LIT>' <EOL> def test_template_filter_with_name ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> @ bp . app_template_filter ( '<STR_LIT>' ) <EOL> def my_reverse ( s ) : <EOL> return s [ : : - <NUM_LIT:1> ] <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> assert '<STR_LIT>' in app . jinja_env . filters . keys ( ) <EOL> assert app . jinja_env . filters [ '<STR_LIT>' ] == my_reverse <EOL> assert app . jinja_env . filters [ '<STR_LIT>' ] ( '<STR_LIT>' ) == '<STR_LIT>' <EOL> def test_add_template_filter_with_name ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> def my_reverse ( s ) : <EOL> return s [ : : - <NUM_LIT:1> ] <EOL> bp . add_app_template_filter ( my_reverse , '<STR_LIT>' ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> assert '<STR_LIT>' in app . jinja_env . filters . keys ( ) <EOL> assert app . jinja_env . filters [ '<STR_LIT>' ] == my_reverse <EOL> assert app . jinja_env . filters [ '<STR_LIT>' ] ( '<STR_LIT>' ) == '<STR_LIT>' <EOL> def test_template_filter_with_template ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> @ bp . app_template_filter ( ) <EOL> def super_reverse ( s ) : <EOL> return s [ : : - <NUM_LIT:1> ] <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> @ app . route ( '<STR_LIT:/>' ) <EOL> def index ( ) : <EOL> return flask . render_template ( '<STR_LIT>' , value = '<STR_LIT>' ) <EOL> rv = app . test_client ( ) . get ( '<STR_LIT:/>' ) <EOL> assert rv . data == b'<STR_LIT>' <EOL> def test_template_filter_after_route_with_template ( ) : <EOL> app = flask . Flask ( __name__ ) <EOL> @ app . route ( '<STR_LIT:/>' ) <EOL> def index ( ) : <EOL> return flask . render_template ( '<STR_LIT>' , value = '<STR_LIT>' ) <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> @ bp . app_template_filter ( ) <EOL> def super_reverse ( s ) : <EOL> return s [ : : - <NUM_LIT:1> ] <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> rv = app . test_client ( ) . get ( '<STR_LIT:/>' ) <EOL> assert rv . data == b'<STR_LIT>' <EOL> def test_add_template_filter_with_template ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> def super_reverse ( s ) : <EOL> return s [ : : - <NUM_LIT:1> ] <EOL> bp . add_app_template_filter ( super_reverse ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> @ app . route ( '<STR_LIT:/>' ) <EOL> def index ( ) : <EOL> return flask . render_template ( '<STR_LIT>' , value = '<STR_LIT>' ) <EOL> rv = app . test_client ( ) . get ( '<STR_LIT:/>' ) <EOL> assert rv . data == b'<STR_LIT>' <EOL> def test_template_filter_with_name_and_template ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> @ bp . app_template_filter ( '<STR_LIT>' ) <EOL> def my_reverse ( s ) : <EOL> return s [ : : - <NUM_LIT:1> ] <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> @ app . route ( '<STR_LIT:/>' ) <EOL> def index ( ) : <EOL> return flask . render_template ( '<STR_LIT>' , value = '<STR_LIT>' ) <EOL> rv = app . test_client ( ) . get ( '<STR_LIT:/>' ) <EOL> assert rv . data == b'<STR_LIT>' <EOL> def test_add_template_filter_with_name_and_template ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> def my_reverse ( s ) : <EOL> return s [ : : - <NUM_LIT:1> ] <EOL> bp . add_app_template_filter ( my_reverse , '<STR_LIT>' ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> @ app . route ( '<STR_LIT:/>' ) <EOL> def index ( ) : <EOL> return flask . render_template ( '<STR_LIT>' , value = '<STR_LIT>' ) <EOL> rv = app . test_client ( ) . get ( '<STR_LIT:/>' ) <EOL> assert rv . data == b'<STR_LIT>' <EOL> def test_template_test ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> @ bp . app_template_test ( ) <EOL> def is_boolean ( value ) : <EOL> return isinstance ( value , bool ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> assert '<STR_LIT>' in app . jinja_env . tests . keys ( ) <EOL> assert app . jinja_env . tests [ '<STR_LIT>' ] == is_boolean <EOL> assert app . jinja_env . tests [ '<STR_LIT>' ] ( False ) <EOL> def test_add_template_test ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> def is_boolean ( value ) : <EOL> return isinstance ( value , bool ) <EOL> bp . add_app_template_test ( is_boolean ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> assert '<STR_LIT>' in app . jinja_env . tests . keys ( ) <EOL> assert app . jinja_env . tests [ '<STR_LIT>' ] == is_boolean <EOL> assert app . jinja_env . tests [ '<STR_LIT>' ] ( False ) <EOL> def test_template_test_with_name ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> @ bp . app_template_test ( '<STR_LIT>' ) <EOL> def is_boolean ( value ) : <EOL> return isinstance ( value , bool ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> assert '<STR_LIT>' in app . jinja_env . tests . keys ( ) <EOL> assert app . jinja_env . tests [ '<STR_LIT>' ] == is_boolean <EOL> assert app . jinja_env . tests [ '<STR_LIT>' ] ( False ) <EOL> def test_add_template_test_with_name ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> def is_boolean ( value ) : <EOL> return isinstance ( value , bool ) <EOL> bp . add_app_template_test ( is_boolean , '<STR_LIT>' ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> assert '<STR_LIT>' in app . jinja_env . tests . keys ( ) <EOL> assert app . jinja_env . tests [ '<STR_LIT>' ] == is_boolean <EOL> assert app . jinja_env . tests [ '<STR_LIT>' ] ( False ) <EOL> def test_template_test_with_template ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> @ bp . app_template_test ( ) <EOL> def boolean ( value ) : <EOL> return isinstance ( value , bool ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> @ app . route ( '<STR_LIT:/>' ) <EOL> def index ( ) : <EOL> return flask . render_template ( '<STR_LIT>' , value = False ) <EOL> rv = app . test_client ( ) . get ( '<STR_LIT:/>' ) <EOL> assert b'<STR_LIT>' in rv . data <EOL> def test_template_test_after_route_with_template ( ) : <EOL> app = flask . Flask ( __name__ ) <EOL> @ app . route ( '<STR_LIT:/>' ) <EOL> def index ( ) : <EOL> return flask . render_template ( '<STR_LIT>' , value = False ) <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> @ bp . app_template_test ( ) <EOL> def boolean ( value ) : <EOL> return isinstance ( value , bool ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> rv = app . test_client ( ) . get ( '<STR_LIT:/>' ) <EOL> assert b'<STR_LIT>' in rv . data <EOL> def test_add_template_test_with_template ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> def boolean ( value ) : <EOL> return isinstance ( value , bool ) <EOL> bp . add_app_template_test ( boolean ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> @ app . route ( '<STR_LIT:/>' ) <EOL> def index ( ) : <EOL> return flask . render_template ( '<STR_LIT>' , value = False ) <EOL> rv = app . test_client ( ) . get ( '<STR_LIT:/>' ) <EOL> assert b'<STR_LIT>' in rv . data <EOL> def test_template_test_with_name_and_template ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> @ bp . app_template_test ( '<STR_LIT>' ) <EOL> def is_boolean ( value ) : <EOL> return isinstance ( value , bool ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> @ app . route ( '<STR_LIT:/>' ) <EOL> def index ( ) : <EOL> return flask . render_template ( '<STR_LIT>' , value = False ) <EOL> rv = app . test_client ( ) . get ( '<STR_LIT:/>' ) <EOL> assert b'<STR_LIT>' in rv . data <EOL> def test_add_template_test_with_name_and_template ( ) : <EOL> bp = flask . Blueprint ( '<STR_LIT>' , __name__ ) <EOL> def is_boolean ( value ) : <EOL> return isinstance ( value , bool ) <EOL> bp . add_app_template_test ( is_boolean , '<STR_LIT>' ) <EOL> app = flask . Flask ( __name__ ) <EOL> app . register_blueprint ( bp , url_prefix = '<STR_LIT>' ) <EOL> @ app . route ( '<STR_LIT:/>' ) <EOL> def index ( ) : <EOL> return flask . render_template ( '<STR_LIT>' , value = False ) <EOL> rv = app . test_client ( ) . get ( '<STR_LIT:/>' ) <EOL> assert b'<STR_LIT>' in rv . data </s>
