@@ -386,22 +386,6 @@ def test_cast(self):
386386
387387 def test_cast_primitive (self ):
388388 # Test casting for primitive types
389- def _cast_node (node : Vertex ):
390- return {
391- "vid" : node .get_id ().cast (),
392- "tags" : {
393- tag_name : node .properties (tag_name ) for tag_name in node .tags ()
394- },
395- }
396-
397- def _cast_relationship (edge : Edge ):
398- return {
399- "src" : edge .start_vertex_id ().cast (),
400- "dst" : edge .end_vertex_id ().cast (),
401- "type" : edge .edge_name (),
402- "rank" : edge .ranking (),
403- "props" : edge .properties (),
404- }
405389
406390 # Test boolean
407391 bool_val = ttypes .Value (bVal = True )
@@ -423,37 +407,6 @@ def _cast_relationship(edge: Edge):
423407 null_val = ttypes .Value (nVal = ttypes .NullType .__NULL__ )
424408 assert ValueWrapper (null_val ).cast_primitive () is None
425409
426- # Test node
427- node_val = ttypes .Value (vVal = self .get_vertex_value (b"Tom" ))
428- node = ValueWrapper (node_val ).as_node ()
429- assert ValueWrapper (node_val ).cast_primitive () == {
430- "vid" : node .get_id ().cast (),
431- "tags" : {tag_name : node .properties (tag_name ) for tag_name in node .tags ()},
432- }
433-
434- # Test relationship
435- relationship_val = ttypes .Value (eVal = self .get_edge_value (b"Tom" , b"Lily" ))
436- edge = ValueWrapper (relationship_val ).as_relationship ()
437- assert ValueWrapper (relationship_val ).cast_primitive () == {
438- "src" : edge .start_vertex_id ().cast (),
439- "dst" : edge .end_vertex_id ().cast (),
440- "type" : edge .edge_name (),
441- "rank" : edge .ranking (),
442- "props" : edge .properties (),
443- }
444-
445- # Test path
446- path_val = ttypes .Value (pVal = self .get_path_value (b"Tom" ))
447- path_raw = ValueWrapper (path_val )
448- path = path_raw .as_path ()
449- path_primitive = path_raw .cast_primitive ()
450- assert path_primitive == {
451- "path_str" : path .__repr__ (),
452- "start_node" : _cast_node (path .start_node ()),
453- "edges" : [_cast_relationship (x ) for x in path .relationships ()],
454- "nodes" : [_cast_node (x ) for x in path .nodes ()],
455- }
456-
457410 # Test geography
458411 geography_val = ttypes .Value (ggVal = self .get_geography_value (3.0 , 5.2 ))
459412 geography_raw = ValueWrapper (geography_val )
0 commit comments