<s> """<STR_LIT>""" <EOL> import os <EOL> import unittest <EOL> from test_all import db , dbshelve , test_support , verbose , get_new_environment_path , get_new_database_path <EOL> ProductIndex = [ <EOL> ( '<STR_LIT>' , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , "<STR_LIT>" ) , <EOL> ] <EOL> ColorIndex = [ <EOL> ( '<STR_LIT>' , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , "<STR_LIT>" ) , <EOL> ( '<STR_LIT>' , "<STR_LIT>" ) , <EOL> ] <EOL> class JoinTestCase ( unittest . TestCase ) : <EOL> keytype = '<STR_LIT>' <EOL> def setUp ( self ) : <EOL> self . filename = self . __class__ . __name__ + '<STR_LIT>' <EOL> self . homeDir = get_new_environment_path ( ) <EOL> self . env = db . DBEnv ( ) <EOL> self . env . open ( self . homeDir , db . DB_CREATE | db . DB_INIT_MPOOL | db . DB_INIT_LOCK ) <EOL> def tearDown ( self ) : <EOL> self . env . close ( ) <EOL> test_support . rmtree ( self . homeDir ) <EOL> def test01_join ( self ) : <EOL> if verbose : <EOL> print '<STR_LIT:\n>' , '<STR_LIT>' * <NUM_LIT:30> <EOL> print "<STR_LIT>" % self . __class__ . __name__ <EOL> priDB = db . DB ( self . env ) <EOL> priDB . open ( self . filename , "<STR_LIT>" , db . DB_BTREE , db . DB_CREATE ) <EOL> map ( lambda t , priDB = priDB : priDB . put ( * t ) , ProductIndex ) <EOL> secDB = db . DB ( self . env ) <EOL> secDB . set_flags ( db . DB_DUP | db . DB_DUPSORT ) <EOL> secDB . open ( self . filename , "<STR_LIT>" , db . DB_BTREE , db . DB_CREATE ) <EOL> map ( lambda t , secDB = secDB : secDB . put ( * t ) , ColorIndex ) <EOL> sCursor = None <EOL> jCursor = None <EOL> try : <EOL> sCursor = secDB . cursor ( ) <EOL> tmp = sCursor . set ( '<STR_LIT>' ) <EOL> self . assertTrue ( tmp ) <EOL> jCursor = priDB . join ( [ sCursor ] ) <EOL> if jCursor . get ( <NUM_LIT:0> ) != ( '<STR_LIT>' , "<STR_LIT>" ) : <EOL> self . fail ( "<STR_LIT>" ) <EOL> if jCursor . join_item ( ) != '<STR_LIT>' : <EOL> self . fail ( "<STR_LIT>" ) <EOL> if jCursor . get ( <NUM_LIT:0> ) [ <NUM_LIT:0> ] != '<STR_LIT>' : <EOL> self . fail ( "<STR_LIT>" ) <EOL> if jCursor . get ( <NUM_LIT:0> ) : <EOL> self . fail ( "<STR_LIT>" ) <EOL> finally : <EOL> if jCursor : <EOL> jCursor . close ( ) <EOL> if sCursor : <EOL> sCursor . close ( ) <EOL> priDB . close ( ) <EOL> secDB . close ( ) <EOL> def test_suite ( ) : <EOL> suite = unittest . TestSuite ( ) <EOL> suite . addTest ( unittest . makeSuite ( JoinTestCase ) ) <EOL> return suite </s>
