<s> __author__ = '<STR_LIT>' <EOL> from unittest import skip <EOL> from rexpro . tests . base import BaseRexProTestCase , multi_graph <EOL> from rexpro import exceptions <EOL> class TestConnection ( BaseRexProTestCase ) : <EOL> def test_connection_success ( self ) : <EOL> """<STR_LIT>""" <EOL> conn = self . get_connection ( ) <EOL> def test_attempting_to_connect_to_an_invalid_graphname_raises_exception ( self ) : <EOL> """<STR_LIT>""" <EOL> with self . assertRaises ( exceptions . RexProConnectionException ) : <EOL> self . get_connection ( graphname = '<STR_LIT>' ) <EOL> @ skip <EOL> def test_invalid_connection_info_raises_exception ( self ) : <EOL> pass <EOL> @ skip <EOL> def test_call_close_transactions_without_an_open_transaction_fails ( self ) : <EOL> pass <EOL> @ skip <EOL> def test_call_open_transaction_with_a_transaction_already_open_fails ( self ) : <EOL> pass <EOL> class TestQueries ( BaseRexProTestCase ) : <EOL> @ multi_graph <EOL> def test_data_integrity ( self ) : <EOL> """<STR_LIT>""" <EOL> conn = self . get_connection ( graphname = self . graphname ) <EOL> e = lambda p : conn . execute ( <EOL> script = '<STR_LIT>' , <EOL> params = { '<STR_LIT>' : p } <EOL> ) <EOL> data = e ( '<STR_LIT>' ) <EOL> assert data == '<STR_LIT>' <EOL> data = e ( <NUM_LIT> ) <EOL> assert data == <NUM_LIT> <EOL> data = e ( <NUM_LIT> ) <EOL> assert data == <NUM_LIT> <EOL> data = e ( { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> assert data == { '<STR_LIT>' : '<STR_LIT>' } <EOL> data = e ( None ) <EOL> assert data is None <EOL> data = e ( [ <NUM_LIT:1> , <NUM_LIT:2> ] ) <EOL> assert data == ( <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> def test_query_isolation ( self ) : <EOL> """<STR_LIT>""" <EOL> conn = self . get_connection ( ) <EOL> conn . execute ( <EOL> """<STR_LIT>""" , <EOL> pretty = True <EOL> ) <EOL> with self . assertRaises ( exceptions . RexProScriptException ) : <EOL> r = conn . execute ( <EOL> """<STR_LIT>""" <EOL> ) <EOL> def test_element_creation ( self ) : <EOL> """<STR_LIT>""" <EOL> conn = self . get_connection ( ) <EOL> elements = conn . execute ( <EOL> """<STR_LIT>""" <EOL> ) <EOL> v1 , v2 , e = elements <EOL> assert v1 [ '<STR_LIT>' ] [ '<STR_LIT>' ] == <NUM_LIT:6> <EOL> assert v2 [ '<STR_LIT>' ] [ '<STR_LIT>' ] == <NUM_LIT:8> <EOL> assert e [ '<STR_LIT>' ] [ '<STR_LIT>' ] == <NUM_LIT:10> <EOL> assert e [ '<STR_LIT>' ] == v1 [ '<STR_LIT>' ] <EOL> assert e [ '<STR_LIT>' ] == v2 [ '<STR_LIT>' ] <EOL> class TestTransactions ( BaseRexProTestCase ) : <EOL> def test_transaction_isolation ( self ) : <EOL> """<STR_LIT>""" <EOL> conn1 = self . get_connection ( ) <EOL> conn2 = self . get_connection ( ) <EOL> if not conn1 . graph_features [ '<STR_LIT>' ] : <EOL> return <EOL> with conn1 . transaction ( ) : <EOL> v1 , v2 , v3 = conn1 . execute ( <EOL> """<STR_LIT>""" <EOL> ) <EOL> conn1 . open_transaction ( ) <EOL> conn2 . open_transaction ( ) <EOL> v1_1 = conn1 . execute ( <EOL> """<STR_LIT>""" , <EOL> params = { '<STR_LIT>' : v1 [ '<STR_LIT>' ] } <EOL> ) <EOL> v1_2 = conn2 . execute ( <EOL> """<STR_LIT>""" , <EOL> params = { '<STR_LIT>' : v1 [ '<STR_LIT>' ] } <EOL> ) <EOL> assert v1_2 [ '<STR_LIT>' ] [ '<STR_LIT:str>' ] == '<STR_LIT>' </s>
