<s> import unittest <EOL> from bulbs . tests . testcase import BulbsTestCase <EOL> from bulbs . element import Vertex , VertexProxy , Edge , EdgeProxy <EOL> from bulbs . config import Config <EOL> from bulbs . rexster import RexsterClient , REXSTER_URI <EOL> from bulbs . rexster . index import VertexIndexProxy , EdgeIndexProxy , ManualIndex <EOL> config = Config ( REXSTER_URI ) <EOL> BulbsTestCase . client = RexsterClient ( config ) <EOL> BulbsTestCase . index_class = ManualIndex <EOL> class IndexTestCase ( BulbsTestCase ) : <EOL> def setUp ( self ) : <EOL> self . indicesV = VertexIndexProxy ( self . index_class , self . client ) <EOL> self . indicesE = EdgeIndexProxy ( self . index_class , self . client ) <EOL> self . indicesV . delete ( "<STR_LIT>" ) <EOL> self . indicesE . delete ( "<STR_LIT>" ) <EOL> self . vertices = VertexProxy ( Vertex , self . client ) <EOL> self . vertices . index = self . indicesV . get_or_create ( "<STR_LIT>" ) <EOL> self . edges = EdgeProxy ( Edge , self . client ) <EOL> self . edges . index = self . indicesE . get_or_create ( "<STR_LIT>" ) <EOL> def test_index ( self ) : <EOL> index_name = "<STR_LIT>" <EOL> james = self . vertices . create ( { '<STR_LIT:name>' : '<STR_LIT>' } ) <EOL> self . vertices . index . put ( james . _id , '<STR_LIT:name>' , '<STR_LIT>' ) <EOL> self . vertices . index . put ( james . _id , '<STR_LIT:location>' , '<STR_LIT>' ) <EOL> results = self . vertices . index . lookup ( '<STR_LIT:name>' , '<STR_LIT>' ) <EOL> results = list ( results ) <EOL> assert len ( results ) == <NUM_LIT:1> <EOL> assert results [ <NUM_LIT:0> ] . name == "<STR_LIT>" <EOL> total_size = self . vertices . index . count ( '<STR_LIT:name>' , '<STR_LIT>' ) <EOL> assert total_size == <NUM_LIT:1> <EOL> i2 = self . indicesV . get ( index_name ) <EOL> assert self . vertices . index . index_name == i2 . index_name <EOL> self . indicesV . delete ( index_name ) <EOL> def suite ( ) : <EOL> suite = unittest . TestSuite ( ) <EOL> suite . addTest ( unittest . makeSuite ( IndexTestCase ) ) <EOL> return suite <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( defaultTest = '<STR_LIT>' ) </s>
