<s> import unittest <EOL> from redis_shard . shard import RedisShardAPI <EOL> from redis_shard . _compat import b <EOL> from nose . tools import eq_ <EOL> from . config import settings <EOL> class TestShard ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . client = RedisShardAPI ( ** settings ) <EOL> self . clear_db ( ) <EOL> def tearDown ( self ) : <EOL> pass <EOL> def clear_db ( self ) : <EOL> self . client . delete ( '<STR_LIT>' ) <EOL> self . client . delete ( '<STR_LIT>' ) <EOL> self . client . delete ( '<STR_LIT>' ) <EOL> self . client . delete ( '<STR_LIT>' ) <EOL> self . client . delete ( '<STR_LIT>' ) <EOL> self . client . delete ( '<STR_LIT>' ) <EOL> self . client . delete ( '<STR_LIT>' ) <EOL> self . client . delete ( '<STR_LIT>' ) <EOL> def test_zset ( self ) : <EOL> self . client . zadd ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . client . zadd ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:2> ) <EOL> self . client . zrange ( '<STR_LIT>' , <NUM_LIT:0> , - <NUM_LIT:1> ) == [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> def test_list ( self ) : <EOL> self . client . rpush ( '<STR_LIT>' , <NUM_LIT:0> ) <EOL> self . client . rpush ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . client . rpush ( '<STR_LIT>' , <NUM_LIT:2> ) <EOL> self . client . rpush ( '<STR_LIT>' , <NUM_LIT:3> ) <EOL> self . client . rpop ( '<STR_LIT>' ) <EOL> self . client . lpop ( '<STR_LIT>' ) <EOL> self . client . lrange ( '<STR_LIT>' , <NUM_LIT:0> , - <NUM_LIT:1> ) == [ '<STR_LIT:1>' , '<STR_LIT:2>' ] <EOL> def test_mget ( self ) : <EOL> self . client . set ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . client . set ( '<STR_LIT>' , <NUM_LIT:2> ) <EOL> self . client . set ( '<STR_LIT>' , <NUM_LIT:3> ) <EOL> eq_ ( self . client . mget ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , [ b ( '<STR_LIT:1>' ) , b ( '<STR_LIT:2>' ) , b ( '<STR_LIT:3>' ) ] ) <EOL> def test_mset ( self ) : <EOL> self . client . mset ( { '<STR_LIT>' : <NUM_LIT:4> , '<STR_LIT>' : <NUM_LIT:5> , '<STR_LIT>' : <NUM_LIT:6> } ) <EOL> eq_ ( self . client . get ( '<STR_LIT>' ) , b ( '<STR_LIT:4>' ) ) <EOL> eq_ ( self . client . mget ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) , [ b ( '<STR_LIT:4>' ) , b ( '<STR_LIT:5>' ) , b ( '<STR_LIT>' ) ] ) <EOL> def test_eval ( self ) : <EOL> self . client . eval ( """<STR_LIT>""" , <NUM_LIT:1> , '<STR_LIT>' , '<STR_LIT>' ) <EOL> eq_ ( self . client . get ( '<STR_LIT>' ) , b ( '<STR_LIT>' ) ) <EOL> def test_evalsha ( self ) : <EOL> sha = self . client . script_load ( """<STR_LIT>""" ) <EOL> eq_ ( self . client . evalsha ( sha , <NUM_LIT:1> , '<STR_LIT>' , b ( '<STR_LIT>' ) ) , b ( '<STR_LIT:OK>' ) ) <EOL> eq_ ( self . client . get ( '<STR_LIT>' ) , b ( '<STR_LIT>' ) ) </s>
