tests/test_manager/test_manager_graph.py
def _help_reconstitute(self, node: BaseEntity, number_nodes: int, number_edges: int):
        """Help test the round-trip conversion from PyBEL data dictionary to node model."""
        self.assertIsInstance(node, BaseEntity)

        graph = BELGraph(name='test', version='0.0.0')
        graph.add_node_from_data(node)

        make_dummy_namespaces(self.manager, graph)

        self.manager.insert_graph(graph)
        self.assertEqual(number_nodes, self.manager.count_nodes())
        self.assertEqual(number_edges, self.manager.count_edges())

        node_model = self.manager.get_or_create_node(graph, node)
        self.assertEqual(node.md5, node_model.md5)
        self.manager.session.commit()

        self.assertEqual(node, node_model.to_json())
        self.assertEqual(node, self.manager.get_dsl_by_hash(node.md5))
Help test the round-trip conversion from PyBEL data dictionary to node model.
Help test the round-trip conversion from PyBEL data dictionary to node model.
Help test the round - trip conversion from PyBEL data dictionary to node model .
def _help_reconstitute(self, node: BaseEntity, number_nodes: int, number_edges: int):
        self.assertIsInstance(node, BaseEntity)
        graph = BELGraph(name='test', version='0.0.0')
        graph.add_node_from_data(node)
        make_dummy_namespaces(self.manager, graph)
        self.manager.insert_graph(graph)
        self.assertEqual(number_nodes, self.manager.count_nodes())
        self.assertEqual(number_edges, self.manager.count_edges())
        node_model = self.manager.get_or_create_node(graph, node)
        self.assertEqual(node.md5, node_model.md5)
        self.manager.session.commit()
        self.assertEqual(node, node_model.to_json())
        self.assertEqual(node, self.manager.get_dsl_by_hash(node.md5))
def _help_reconstitute ( self , node : BaseEntity , number_nodes : int , number_edges : int ) : self . assertIsInstance ( node , BaseEntity ) graph = BELGraph ( name = 'test' , version = '0.0.0' ) graph . add_node_from_data ( node ) make_dummy_namespaces ( self . manager , graph ) self . manager . insert_graph ( graph ) self . assertEqual ( number_nodes , self . manager . count_nodes ( ) ) self . assertEqual ( number_edges , self . manager . count_edges ( ) ) node_model = self . manager . get_or_create_node ( graph , node ) self . assertEqual ( node . md5 , node_model . md5 ) self . manager . session . commit ( ) self . assertEqual ( node , node_model . to_json ( ) ) self . assertEqual ( node , self . manager . get_dsl_by_hash ( node . md5 ) )
Help test the round-trip conversion from PyBEL data dictionary to node model.
Help test the round - trip conversion from PyBEL data dictionary to node model .
"""Help test the round-trip conversion from PyBEL data dictionary to node model."""
self
node
BaseEntity
number_nodes
int
number_edges
int