Skip to content
Myr

Changed sort_json test to test str sorting

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

Tests when simplejson was installed were failing because of a change in how it sorted in v3.0.0. This change first tests it via normal int sorting for stdlib json then if that fails, it tests against str sorting for simplejson.

authored by Chason Chaffin · committed by Chason Chaffin · parent 0893140 · Browse files · 1 file+32 added−2 removed
This commit

State

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

Diff stats

1 file+32 added−2 removed

  • other:+32 added−2 removed

1 file+32 added−2 removed

modified:flask/testsuite/helpers.py+32 added-2 removed
171 unmodified lines
172173 c = app.test_client()174 rv = c.get('/')175 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 = [203 '{',204 '"values": {',205 '"0": "foo",',206 '"1": "foo",',207 '"2": "foo",',208 '"3": "foo",',209 '"4": "foo",',210 '"5": "foo",',211 '"6": "foo",',212 '"7": "foo",',213 '"8": "foo",',214 '"9": "foo",',215 '"10": "foo",',216 '"11": "foo",',217 '"12": "foo",',
5 unmodified lines
223 '"18": "foo",',224 '"19": "foo"',225 '}',226 '}'201 ])227 ]228229 try:230 self.assert_equal(lines, sorted_by_int)231 except AssertionError:232 self.assert_equal(lines, sorted_by_str)233234class SendfileTestCase(FlaskTestCase):235236 def test_send_file_regular(self):
387 unmodified lines