Skip to content

Commit a2bc61b

Browse files
committed
Merge pull request pallets#819 from chason/master
Changed sort_json test to test str sorting
2 parents 0893140 + 5e8dd8b commit a2bc61b

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

flask/testsuite/helpers.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,33 @@ def index():
173173
c = app.test_client()
174174
rv = c.get('/')
175175
lines = [x.strip() for x in rv.data.strip().decode('utf-8').splitlines()]
176-
self.assert_equal(lines, [
176+
sorted_by_str = [
177+
'{',
178+
'"values": {',
179+
'"0": "foo",',
180+
'"1": "foo",',
181+
'"10": "foo",',
182+
'"11": "foo",',
183+
'"12": "foo",',
184+
'"13": "foo",',
185+
'"14": "foo",',
186+
'"15": "foo",',
187+
'"16": "foo",',
188+
'"17": "foo",',
189+
'"18": "foo",',
190+
'"19": "foo",',
191+
'"2": "foo",',
192+
'"3": "foo",',
193+
'"4": "foo",',
194+
'"5": "foo",',
195+
'"6": "foo",',
196+
'"7": "foo",',
197+
'"8": "foo",',
198+
'"9": "foo"',
199+
'}',
200+
'}'
201+
]
202+
sorted_by_int = [
177203
'{',
178204
'"values": {',
179205
'"0": "foo",',
@@ -198,8 +224,12 @@ def index():
198224
'"19": "foo"',
199225
'}',
200226
'}'
201-
])
227+
]
202228

229+
try:
230+
self.assert_equal(lines, sorted_by_int)
231+
except AssertionError:
232+
self.assert_equal(lines, sorted_by_str)
203233

204234
class SendfileTestCase(FlaskTestCase):
205235

0 commit comments

Comments
 (0)