<s> import unittest <EOL> from pyley import GraphObject <EOL> class GremlinQueryTests ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . opts = dict ( url = '<STR_LIT>' ) <EOL> def test_vertex_query ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . Vertex ( ) <EOL> self . assertEqual ( query . build ( ) , "<STR_LIT>" ) <EOL> def test_vertex_query_with_parameters ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . V ( "<STR_LIT>" ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" ) <EOL> def test_morphism_query ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . Morphism ( ) <EOL> self . assertEqual ( query . build ( ) , "<STR_LIT>" ) <EOL> def test_out_query ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . V ( ) . Out ( '<STR_LIT:name>' ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" ) <EOL> def test_out_query_with_predicate ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . V ( ) . Out ( g . Vertex ( ) ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" ) <EOL> def test_out_query_with_predicate_as_dict_and_label ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . V ( ) . Out ( [ '<STR_LIT:foo>' , '<STR_LIT:bar>' ] , '<STR_LIT>' ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" ) <EOL> def test_out_query_with_predicate_as_none_and_label_as_dict ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . V ( ) . Out ( None , [ '<STR_LIT:foo>' , '<STR_LIT:bar>' ] ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" ) <EOL> def test_in_query ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . V ( ) . In ( "<STR_LIT:name>" ) . All ( ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" ) <EOL> def test_both ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . V ( "<STR_LIT:F>" ) . Both ( "<STR_LIT>" ) <EOL> actual = query . build ( ) <EOL> print actual <EOL> self . assertEqual ( actual , "<STR_LIT>" ) <EOL> def test_is ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . V ( ) . Is ( '<STR_LIT:B>' , '<STR_LIT:C>' ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" ) <EOL> def test_tag ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . V ( ) . Tag ( '<STR_LIT:B>' , '<STR_LIT:C>' ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , '<STR_LIT>' ) <EOL> def test_save ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . V ( ) . Save ( '<STR_LIT:B>' , '<STR_LIT:C>' ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" ) <EOL> def test_back ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . V ( ) . Back ( '<STR_LIT:B>' ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" ) <EOL> def test_all_query ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . V ( "<STR_LIT>" ) . All ( ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" ) <EOL> def test_has_query ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . V ( ) . Has ( "<STR_LIT:name>" , "<STR_LIT>" ) . All ( ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" ) <EOL> def test_complex_query1 ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . V ( ) . Has ( "<STR_LIT:name>" , "<STR_LIT>" ) . Out ( "<STR_LIT>" ) . Out ( "<STR_LIT>" ) . Out ( "<STR_LIT:name>" ) . All ( ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def test_follow_with_morphism_path_and_typed_query ( self ) : <EOL> g = GraphObject ( ) <EOL> film_to_actor = g . Morphism ( ) . Out ( "<STR_LIT>" ) . Out ( "<STR_LIT>" ) <EOL> query = g . V ( ) . Has ( "<STR_LIT:name>" , "<STR_LIT>" ) . Follow ( film_to_actor ) . Out ( "<STR_LIT:name>" ) . All ( ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def test_follow_with_morphism_path_and_str_query ( self ) : <EOL> g = GraphObject ( ) <EOL> film_to_actor = g . Morphism ( ) . Out ( "<STR_LIT>" ) . Out ( "<STR_LIT>" ) <EOL> query = g . V ( ) . Has ( "<STR_LIT:name>" , "<STR_LIT>" ) . Follow ( film_to_actor . build ( ) ) . Out ( "<STR_LIT:name>" ) . All ( ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def test_follow_with_vertex ( self ) : <EOL> g = GraphObject ( ) <EOL> with self . assertRaises ( Exception ) : <EOL> g . V ( ) . Follow ( g . V ( ) ) . build ( ) <EOL> def test_union ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . Vertex ( ) . Union ( g . Vertex ( ) ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" ) <EOL> def test_intersect ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . Vertex ( ) . Intersect ( g . Vertex ( ) ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" ) <EOL> def test_get_limit ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . Vertex ( ) . GetLimit ( <NUM_LIT:5> ) <EOL> actual = query . build ( ) <EOL> self . assertEqual ( actual , "<STR_LIT>" ) <EOL> def test_emit ( self ) : <EOL> g = GraphObject ( ) <EOL> query = g . Emit ( { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT> } ) <EOL> self . assertEqual ( query , '<STR_LIT>' ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
