Skip to content

Commit c778399

Browse files
committed
Merge branch 'improvements/pallets-eco#14-3rd-party-decorator' into develop
2 parents 92ad555 + 492797b commit c778399

File tree

3 files changed

+64
-35
lines changed

3 files changed

+64
-35
lines changed

flask_classful.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ def parse_options(cls, options):
167167
endpoint = options.pop('endpoint', None)
168168
return subdomain, endpoint, options,
169169

170-
171170
@classmethod
172171
def make_proxy_method(cls, name):
173172
"""Creates a proxy function that can be used by Flasks routing. The
@@ -190,7 +189,7 @@ def inner(*args, **kwargs):
190189
view = make_func(view)
191190

192191
# Now apply the class decorator list in reverse order
193-
# to match memeber decorator order
192+
# to match member decorator order
194193
if cls.decorators:
195194
for decorator in reversed(cls.decorators):
196195
view = decorator(view)

test_classful/test_decorators.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,88 +68,98 @@ def test_params_decorator_delete():
6868

6969

7070
def test_decorator_bold_list_get():
71-
'''Tests that the get route is wrapped in bold'''
71+
"""Tests that the get route is wrapped in bold"""
7272
resp = client.get('/decorated_bold_list_view/1234')
7373
eq_(b'<b>' in resp.data, True)
7474
eq_(b'</b>' in resp.data, True)
75+
eq_(b'<b>Get 1234</b>', resp.data)
7576

7677

7778
def test_decorator_bold_list_index():
78-
'''Tests that the index route is wrapped in bold'''
79+
"""Tests that the index route is wrapped in bold"""
7980
resp = client.get('/decorated_bold_list_view/')
8081
eq_(b'<b>' in resp.data, True)
8182
eq_(b'</b>' in resp.data, True)
83+
eq_(b'<b>Index</b>', resp.data)
8284

8385

8486
def test_decorator_bold_italics_list_get():
85-
'''Tests that the get route is wrapped in bold and italics'''
87+
"""Tests that the get route is wrapped in bold and italics"""
8688
resp = client.get('/decorated_bold_italics_list_view/1234')
8789
eq_(b'<i>' in resp.data, True)
8890
eq_(b'</i>' in resp.data, True)
8991
eq_(b'<b>' in resp.data, True)
9092
eq_(b'</b>' in resp.data, True)
93+
eq_(b'<b><i>Get 1234</i></b>', resp.data)
9194

9295

9396
def test_decorator_bold_italics_list_index():
94-
'''Tests that the index route is wrapped in bold and italics'''
97+
"""Tests that the index route is wrapped in bold and italics"""
9598
resp = client.get('/decorated_bold_italics_list_view/')
9699
eq_(b'<i>' in resp.data, True)
97100
eq_(b'</i>' in resp.data, True)
98101
eq_(b'<b>' in resp.data, True)
99102
eq_(b'</b>' in resp.data, True)
103+
eq_(b'<b><i>Index</i></b>', resp.data)
100104

101105

102106
def test_decorator_list_member_index():
103-
'''
107+
"""
104108
Tests that the index route is wrapped in bold,
105109
italics and paragraph
106-
'''
110+
"""
107111
resp = client.get('/decorated_list_member_view/')
108112
eq_(b'<i>' in resp.data, True)
109113
eq_(b'</i>' in resp.data, True)
110114
eq_(b'<b>' in resp.data, True)
111115
eq_(b'</b>' in resp.data, True)
112116
eq_(b'<p>' not in resp.data, True)
113117
eq_(b'</p>' not in resp.data, True)
118+
eq_(b'<b><i>Index</i></b>', resp.data)
114119

115120

116121
def test_decorator_list_member_get():
117-
'''Tests the ordering of decorators'''
122+
"""Tests the ordering of decorators"""
118123
resp = client.get('/decorated_list_member_view/1234')
119124
eq_(b'<b>', resp.data[:3])
120125
eq_(b'<i>', resp.data[3:6])
121126
eq_(b'<p>', resp.data[6:9])
122127
eq_(b'</p>', resp.data[-12:-8])
123128
eq_(b'</i>', resp.data[-8:-4])
124129
eq_(b'</b>', resp.data[-4:])
130+
eq_(b'<b><i><p>Get 1234</p></i></b>', resp.data)
125131

126132

127133
def test_decorator_list_function_attributes_get():
128-
'''Verify list of decorators with attributes modify all functions in FlaskView'''
134+
"""Verify list of decorators with attributes modify all functions in FlaskView"""
129135
resp = client.get('/decorated_list_function_attributes_view/1234')
130136
eq_(b'Get 1234' in resp.data, True)
137+
eq_(b'<i><b>Get 1234</b></i>', resp.data)
131138
eq_(hasattr(app.view_functions['DecoratedListFunctionAttributesView:get'], 'eggs'), True)
132139
eq_('scrambled', app.view_functions['DecoratedListFunctionAttributesView:get'].eggs)
133140

134141

135142
def test_decorator_list_function_attributes_index():
136-
'''Verify list of decorators with attributes modify all functions in FlaskView'''
143+
"""Verify list of decorators with attributes modify all functions in FlaskView"""
137144
resp = client.get('/decorated_list_function_attributes_view/')
138145
eq_(b'Index' in resp.data, True)
146+
eq_(b'<i>Index</i>', resp.data)
139147
eq_(hasattr(app.view_functions['DecoratedListFunctionAttributesView:index'], 'eggs'), True)
140148
eq_('scrambled', app.view_functions['DecoratedListFunctionAttributesView:index'].eggs)
141149

142150

143151
def test_decorator_list_member_function_attributes_get():
144-
'''Verify decorator with attributes does not modify other members'''
152+
"""Verify decorator with attributes does not modify other members"""
145153
resp = client.get('/decorated_list_member_function_attributes_view/4321')
146154
eq_(b'Get 4321' in resp.data, True)
155+
eq_(b'<i><b>Get 4321</b></i>', resp.data)
147156
eq_(hasattr(app.view_functions['DecoratedListMemberFunctionAttributesView:get'], 'eggs'), False)
148157

149158

150159
def test_decorator_list_member_function_attributes_index():
151-
'''Verify decorator with attributes modify decorated memeber functions'''
160+
"""Verify decorator with attributes modify decorated memeber functions"""
152161
resp = client.get('/decorated_list_member_function_attributes_view/')
153162
eq_(b'Index' in resp.data, True)
163+
eq_(b'<i>Index</i>', resp.data)
154164
eq_(hasattr(app.view_functions['DecoratedListMemberFunctionAttributesView:index'], 'eggs'), True)
155165
eq_('scrambled', app.view_functions['DecoratedListMemberFunctionAttributesView:index'].eggs)

0 commit comments

Comments
 (0)