Skip to content

Commit 975b0d9

Browse files
Fixed sort (wasn't working when starting at 0)
Fixed a test error when keys weren't returned in order
1 parent fa4c0ab commit 975b0d9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

client-libraries/python/redis.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def keys(self, pattern):
287287
[u'a']
288288
>>> r.set('a2', 'a')
289289
'OK'
290-
>>> r.keys('a*')
290+
>>> sorted(r.keys('a*'))
291291
[u'a', u'a2']
292292
>>> r.delete('a2')
293293
1
@@ -625,6 +625,8 @@ def sort(self, name, by=None, get=None, start=None, num=None, desc=False, alpha=
625625
[Decimal("1.0"), Decimal("0.5"), Decimal("0.333333333333"), Decimal("0.25")]
626626
>>> r.sort('l', desc=True, start=2, num=1)
627627
[Decimal("0.333333333333")]
628+
>>> r.sort('l', desc=True, start=0, num=2)
629+
[Decimal("1.0"), Decimal("0.5")]
628630
>>> r.set('weight_0.5', 10)
629631
'OK'
630632
>>> r.sort('l', desc=True, by='weight_*')
@@ -642,7 +644,7 @@ def sort(self, name, by=None, get=None, start=None, num=None, desc=False, alpha=
642644
stmt = ['SORT', name]
643645
if by:
644646
stmt.append("BY %s" % by)
645-
if start and num:
647+
if (start==0 or start) and num:
646648
stmt.append("LIMIT %s %s" % (start, num))
647649
if get is None:
648650
pass

0 commit comments

Comments
 (0)