forked from mirror/ledisdb
test cases update for server part changes
This commit is contained in:
parent
aa40be6e3d
commit
38de79a67f
|
@ -41,19 +41,19 @@ class TestCmdList(unittest.TestCase):
|
||||||
assert self.l.lpush('mylist', '1') == 1
|
assert self.l.lpush('mylist', '1') == 1
|
||||||
assert self.l.lpush('mylist', '2') == 2
|
assert self.l.lpush('mylist', '2') == 2
|
||||||
assert self.l.lpush('mylist', '3', '4', '5') == 5
|
assert self.l.lpush('mylist', '3', '4', '5') == 5
|
||||||
assert self.l.lrange('mylist', 0, 5) == ['5', '4', '3', '2', '1']
|
assert self.l.lrange('mylist', 0, -1) == ['5', '4', '3', '2', '1']
|
||||||
|
|
||||||
def test_lrange(self):
|
def test_lrange(self):
|
||||||
self.l.rpush('mylist', '1', '2', '3', '4', '5')
|
self.l.rpush('mylist', '1', '2', '3', '4', '5')
|
||||||
assert self.l.lrange('mylist', 0, 2) == ['1', '2', '3']
|
assert self.l.lrange('mylist', 0, 2) == ['1', '2', '3']
|
||||||
assert self.l.lrange('mylist', 2, 10) == ['3', '4', '5']
|
assert self.l.lrange('mylist', 2, 10) == ['3', '4', '5']
|
||||||
assert self.l.lrange('mylist', 0, 5) == ['1', '2', '3', '4', '5']
|
assert self.l.lrange('mylist', 0, -1) == ['1', '2', '3', '4', '5']
|
||||||
|
|
||||||
def test_rpush(self):
|
def test_rpush(self):
|
||||||
assert self.l.rpush('mylist', '1') == 1
|
assert self.l.rpush('mylist', '1') == 1
|
||||||
assert self.l.rpush('mylist', '2') == 2
|
assert self.l.rpush('mylist', '2') == 2
|
||||||
assert self.l.rpush('mylist', '3', '4') == 4
|
assert self.l.rpush('mylist', '3', '4') == 4
|
||||||
assert self.l.lrange('mylist', 0, 5) == ['1', '2', '3', '4']
|
assert self.l.lrange('mylist', 0, -1) == ['1', '2', '3', '4']
|
||||||
|
|
||||||
def test_rpop(self):
|
def test_rpop(self):
|
||||||
self.l.rpush('mylist', '1', '2', '3')
|
self.l.rpush('mylist', '1', '2', '3')
|
||||||
|
|
|
@ -114,18 +114,18 @@ class TestCmdZset(unittest.TestCase):
|
||||||
|
|
||||||
def test_zrevrangebyscore(self):
|
def test_zrevrangebyscore(self):
|
||||||
self.l.zadd('a', a1=1, a2=2, a3=3, a4=4, a5=5)
|
self.l.zadd('a', a1=1, a2=2, a3=3, a4=4, a5=5)
|
||||||
assert self.l.zrevrangebyscore('a', 2, 4) == ['a4', 'a3', 'a2']
|
assert self.l.zrevrangebyscore('a', 4, 2) == ['a4', 'a3', 'a2']
|
||||||
|
|
||||||
# slicing with start/num
|
# slicing with start/num
|
||||||
assert self.l.zrevrangebyscore('a', 2, 4, start=1, num=2) == \
|
assert self.l.zrevrangebyscore('a', 4, 2, start=1, num=2) == \
|
||||||
['a3', 'a2']
|
['a3', 'a2']
|
||||||
|
|
||||||
# withscores
|
# withscores
|
||||||
assert self.l.zrevrangebyscore('a', 2, 4, withscores=True) == \
|
assert self.l.zrevrangebyscore('a', 4, 2, withscores=True) == \
|
||||||
[('a4', 4.0), ('a3', 3.0), ('a2', 2.0)]
|
[('a4', 4.0), ('a3', 3.0), ('a2', 2.0)]
|
||||||
|
|
||||||
# custom score function
|
# custom score function
|
||||||
assert self.l.zrevrangebyscore('a', 2, 4, withscores=True,
|
assert self.l.zrevrangebyscore('a', 4, 2, withscores=True,
|
||||||
score_cast_func=int) == \
|
score_cast_func=int) == \
|
||||||
[('a4', 4), ('a3', 3), ('a2', 2)]
|
[('a4', 4), ('a3', 3), ('a2', 2)]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue