<s> import os <EOL> import redis <EOL> import unittest <EOL> from alligator . backends . redis_backend import Client as RedisClient <EOL> CONN_STRING = os . environ . get ( '<STR_LIT>' ) <EOL> @ unittest . skipIf ( not CONN_STRING . startswith ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> class RedisTestCase ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( RedisTestCase , self ) . setUp ( ) <EOL> self . backend = RedisClient ( CONN_STRING ) <EOL> self . backend . conn . flushdb ( ) <EOL> def test_init ( self ) : <EOL> self . assertEqual ( self . backend . conn_string , CONN_STRING ) <EOL> self . assertTrue ( isinstance ( self . backend . conn , redis . StrictRedis ) ) <EOL> def test_len ( self ) : <EOL> self . assertEqual ( self . backend . len ( '<STR_LIT:all>' ) , <NUM_LIT:0> ) <EOL> self . assertEqual ( self . backend . len ( '<STR_LIT>' ) , <NUM_LIT:0> ) <EOL> def test_drop_all ( self ) : <EOL> self . backend . push ( '<STR_LIT:all>' , '<STR_LIT:hello>' , { '<STR_LIT>' : <NUM_LIT:1> } ) <EOL> self . backend . push ( '<STR_LIT:all>' , '<STR_LIT>' , { '<STR_LIT>' : <NUM_LIT:2> } ) <EOL> self . assertEqual ( self . backend . len ( '<STR_LIT:all>' ) , <NUM_LIT:2> ) <EOL> self . backend . drop_all ( '<STR_LIT:all>' ) <EOL> self . assertEqual ( self . backend . len ( '<STR_LIT:all>' ) , <NUM_LIT:0> ) <EOL> def test_push ( self ) : <EOL> self . assertEqual ( self . backend . len ( '<STR_LIT:all>' ) , <NUM_LIT:0> ) <EOL> self . backend . push ( '<STR_LIT:all>' , '<STR_LIT:hello>' , { '<STR_LIT>' : <NUM_LIT:1> } ) <EOL> self . assertEqual ( self . backend . len ( '<STR_LIT:all>' ) , <NUM_LIT:1> ) <EOL> def test_pop ( self ) : <EOL> self . backend . push ( '<STR_LIT:all>' , '<STR_LIT:hello>' , { '<STR_LIT>' : <NUM_LIT:1> } ) <EOL> data = self . backend . pop ( '<STR_LIT:all>' ) <EOL> self . assertEqual ( data , "<STR_LIT>" ) <EOL> self . assertEqual ( self . backend . len ( '<STR_LIT:all>' ) , <NUM_LIT:0> ) <EOL> def test_get ( self ) : <EOL> self . backend . push ( '<STR_LIT:all>' , '<STR_LIT:hello>' , { '<STR_LIT>' : <NUM_LIT:1> } ) <EOL> self . backend . push ( '<STR_LIT:all>' , '<STR_LIT>' , { '<STR_LIT>' : <NUM_LIT:2> } ) <EOL> data = self . backend . get ( '<STR_LIT:all>' , '<STR_LIT>' ) <EOL> self . assertEqual ( data , "<STR_LIT>" ) <EOL> self . assertEqual ( self . backend . len ( '<STR_LIT:all>' ) , <NUM_LIT:1> ) </s>
