55from  . import  schema_adapted  as  adapted 
66from  .schema_adapted  import  graph 
77
8+ from  datajoint  import  attribute_adapter 
9+ 
10+ 
811
912def  test_adapted_type ():
13+     attribute_adapter ._switch_adapated_types (True )
1014    c  =  adapted .Connectivity ()
1115    graphs  =  [nx .lollipop_graph (4 , 2 ), nx .star_graph (5 ), nx .barbell_graph (3 , 1 ), nx .cycle_graph (5 )]
1216    c .insert ((i , g ) for  i , g  in  enumerate (graphs ))
@@ -16,6 +20,7 @@ def test_adapted_type():
1620        assert_equal (len (g1 .edges ), len (g2 .edges ))
1721        assert_true (0  ==  len (nx .symmetric_difference (g1 , g2 ).edges ))
1822    c .delete ()
23+     attribute_adapter ._switch_adapated_types (False )
1924
2025
2126# test spawned classes 
@@ -24,6 +29,7 @@ def test_adapted_type():
2429
2530
2631def  test_adapted_spawned ():
32+     attribute_adapter ._switch_adapated_types (True )
2733    c  =  Connectivity ()  # a spawned class 
2834    graphs  =  [nx .lollipop_graph (4 , 2 ), nx .star_graph (5 ), nx .barbell_graph (3 , 1 ), nx .cycle_graph (5 )]
2935    c .insert ((i , g ) for  i , g  in  enumerate (graphs ))
@@ -33,13 +39,15 @@ def test_adapted_spawned():
3339        assert_equal (len (g1 .edges ), len (g2 .edges ))
3440        assert_true (0  ==  len (nx .symmetric_difference (g1 , g2 ).edges ))
3541    c .delete ()
42+     attribute_adapter ._switch_adapated_types (False )
3643
3744
3845# test with virtual module 
3946virtual_module  =  dj .create_virtual_module ('virtual_module' , adapted .schema_name , add_objects = {'graph' : graph })
4047
4148
4249def  test_adapted_virtual ():
50+     attribute_adapter ._switch_adapated_types (True )
4351    c  =  virtual_module .Connectivity ()
4452    graphs  =  [nx .lollipop_graph (4 , 2 ), nx .star_graph (5 ), nx .barbell_graph (3 , 1 ), nx .cycle_graph (5 )]
4553    c .insert ((i , g ) for  i , g  in  enumerate (graphs ))
@@ -53,3 +61,7 @@ def test_adapted_virtual():
5361            assert_equal (len (g1 .edges ), len (g2 .edges ))
5462            assert_true (0  ==  len (nx .symmetric_difference (g1 , g2 ).edges ))
5563    c .delete ()
64+     attribute_adapter ._switch_adapated_types (False )
65+ 
66+ 
67+ 
0 commit comments