Skip to content

Commit

Permalink
python3 fix: make ListObject parameter order match unit test
Browse files Browse the repository at this point in the history
ListObject used to set 'offset' and then 'limit', but the unit test assumes that the order is limit=...&offset=.... Since dict and kwargs are guaranteed to preserve insertion order in python3.6+ (https://www.python.org/dev/peps/pep-0468/), this change makes them insert in the same order as the test expects
Fixes
AssertionError: 'http://example.com/foo?offset=0&limit=10' != 'http://example.com/foo?limit=10&offset=0'
  • Loading branch information
yonran committed Oct 17, 2023
1 parent 577d638 commit 2a2ce87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion remoteobjects/listobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ def __getitem__(self, key):
if isinstance(key, slice):
args = dict()
if key.start is not None:
args['offset'] = key.start
if key.stop is not None:
args['limit'] = key.stop - key.start
args['offset'] = key.start
elif key.stop is not None:
args['limit'] = key.stop
return self.filter(**args)
Expand Down

0 comments on commit 2a2ce87

Please sign in to comment.