Skip to content
This repository has been archived by the owner on Sep 11, 2019. It is now read-only.

Commit

Permalink
Flake8 fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
bmerry committed Feb 19, 2018
1 parent 46ac71a commit c44ae5e
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions test_fakenewsredis.py
Expand Up @@ -3291,6 +3291,7 @@ def test_eval_flushall(self):
''', 0
)

self.assertEqual(val, 1)
self.assertNotIn('r1', r1)
self.assertNotIn('r2', r2)

Expand All @@ -3305,30 +3306,25 @@ def test_eval_incrbyfloat(self):
self.assertEqual(val, 1)

def test_eval_lrange(self):
self.redis.lpush("foo", "bar")
val = self.redis.eval('return redis.call("LRANGE", KEYS[1], 0, 1)', 1, 'foo')
self.assertEqual(val, [b'bar'])

def test_eval_ltrim(self):
self.redis.rpush('foo', 'a', 'b', 'c', 'd')
self.redis.rpush('foo', 'a', 'b')
val = self.redis.eval(
'''
local value = redis.call("LTRIM", KEYS[1], 1, 2);
return type(value) == "table" and value.ok == "OK";
local value = redis.call("LRANGE", KEYS[1], 0, -1);
return type(value) == "table" and value[1] == "a" and value[2] == "b";
''', 1, 'foo'
)
self.assertEqual(val, 1)
self.assertEqual(self.redis.lrange('foo', 0, -1), [b'b', b'c'])

def test_eval_lrange(self):
self.redis.rpush('foo', 'a', 'b')
def test_eval_ltrim(self):
self.redis.rpush('foo', 'a', 'b', 'c', 'd')
val = self.redis.eval(
'''
local value = redis.call("LRANGE", KEYS[1], 0, -1);
return type(value) == "table" and value[1] == "a" and value[2] == "b";
local value = redis.call("LTRIM", KEYS[1], 1, 2);
return type(value) == "table" and value.ok == "OK";
''', 1, 'foo'
)
self.assertEqual(val, 1)
self.assertEqual(self.redis.lrange('foo', 0, -1), [b'b', b'c'])

def test_eval_lset(self):
self.redis.rpush('foo', 'a', 'b')
Expand Down

0 comments on commit c44ae5e

Please sign in to comment.