<s> import os <EOL> import sys <EOL> import unittest <EOL> PY2 = sys . version_info [ <NUM_LIT:0> ] == <NUM_LIT:2> <EOL> CONN_STRING = os . environ . get ( '<STR_LIT>' ) <EOL> @ unittest . skipIf ( <EOL> not PY2 , <EOL> '<STR_LIT>' <EOL> ) <EOL> @ unittest . skipIf ( <EOL> not CONN_STRING . startswith ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' <EOL> ) <EOL> class BeanstalkTestCase ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( BeanstalkTestCase , self ) . setUp ( ) <EOL> from alligator . backends . beanstalk_backend import Client as BeanstalkClient <EOL> self . backend = BeanstalkClient ( CONN_STRING ) <EOL> self . backend . drop_all ( '<STR_LIT:all>' ) <EOL> def test_init ( self ) : <EOL> self . assertEqual ( self . backend . conn_string , CONN_STRING ) <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>" ) <EOL> self . backend . push ( '<STR_LIT:all>' , '<STR_LIT>' , "<STR_LIT>" ) <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>" ) <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>" ) <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> jid_1 = self . backend . push ( '<STR_LIT:all>' , '<STR_LIT:hello>' , "<STR_LIT>" ) <EOL> jid_2 = self . backend . push ( '<STR_LIT:all>' , '<STR_LIT>' , "<STR_LIT>" ) <EOL> data = self . backend . get ( '<STR_LIT:all>' , jid_2 ) <EOL> self . assertEqual ( data , "<STR_LIT>" ) <EOL> self . assertEqual ( self . backend . len ( '<STR_LIT:all>' ) , <NUM_LIT:1> ) </s>
