tests/constants.py
def bel_thorough_reconstituted(
        self,
        graph: BELGraph,
        check_metadata: bool = True,
        check_warnings: bool = True,
        check_provenance: bool = True,
        check_citation_name: bool = True,
        check_path: bool = True,
    ):
        """Check that thorough.bel was loaded properly.

        :param graph: A BEL graph
        :param check_metadata: Check the graph's document section is correct
        :param check_warnings: Check the graph produced the expected warnings
        :param check_provenance: Check the graph's definition section is correct
        :param check_citation_name: Check that the names in the citations get reconstituted. This isn't strictly
                                         necessary since this data can be looked up
        :param check_path: Check the graph contains provenance for its original file
        """
        self.assertIsNotNone(graph)
        self.assertIsInstance(graph, BELGraph)

        if check_warnings:
            self.assertEqual(0, len(graph.warnings),
                             msg='Document warnings:\n{}'.format('\n'.join(map(str, graph.warnings))))

        if check_metadata:
            self.assertLessEqual(set(expected_test_thorough_metadata), set(graph.document))
            self.assertEqual(expected_test_thorough_metadata[METADATA_NAME], graph.name)
            self.assertEqual(expected_test_thorough_metadata[METADATA_VERSION], graph.version)
            self.assertEqual(expected_test_thorough_metadata[METADATA_DESCRIPTION], graph.description)

        if check_path:
            self.assertEqual(test_bel_thorough, graph.path)

        if check_provenance:
            self.assertEqual({'CHEBI', 'HGNC', 'GO', 'MESHD', 'TESTNS2'}, set(graph.namespace_url))
            self.assertEqual({'dbSNP'}, set(graph.namespace_pattern))
            self.assertIn('TESTAN1', graph.annotation_list)
            self.assertIn('TESTAN2', graph.annotation_list)
            self.assertEqual(2, len(graph.annotation_list), msg='Wrong number of locally defined annotations')
            self.assertEqual({'TestRegex'}, set(graph.annotation_pattern))

        for node in graph:
            self.assertIsInstance(node, BaseEntity)

        self.assertEqual(sorted(BEL_THOROUGH_NODES, key=str), sorted(graph, key=str), msg='Nodes not equal')

        # FIXME
        # self.assertEqual(set((u, v) for u, v, _ in e), set(g.edges()))

        self.assertLess(0, graph.number_of_edges())

        for u, v, data in BEL_THOROUGH_EDGES:
            assert_has_edge(self, u, v, graph, permissive=True, **data)
Check that thorough.bel was loaded properly.

        :param graph: A BEL graph
        :param check_metadata: Check the graph's document section is correct
        :param check_warnings: Check the graph produced the expected warnings
        :param check_provenance: Check the graph's definition section is correct
        :param check_citation_name: Check that the names in the citations get reconstituted. This isn't strictly
                                         necessary since this data can be looked up
        :param check_path: Check the graph contains provenance for its original file
        
Check that thorough.bel was loaded properly.
Check that thorough . bel was loaded properly .
def bel_thorough_reconstituted(
        self,
        graph: BELGraph,
        check_metadata: bool = True,
        check_warnings: bool = True,
        check_provenance: bool = True,
        check_citation_name: bool = True,
        check_path: bool = True,
    ):
        self.assertIsNotNone(graph)
        self.assertIsInstance(graph, BELGraph)
        if check_warnings:
            self.assertEqual(0, len(graph.warnings),
                             msg='Document warnings:\n{}'.format('\n'.join(map(str, graph.warnings))))
        if check_metadata:
            self.assertLessEqual(set(expected_test_thorough_metadata), set(graph.document))
            self.assertEqual(expected_test_thorough_metadata[METADATA_NAME], graph.name)
            self.assertEqual(expected_test_thorough_metadata[METADATA_VERSION], graph.version)
            self.assertEqual(expected_test_thorough_metadata[METADATA_DESCRIPTION], graph.description)
        if check_path:
            self.assertEqual(test_bel_thorough, graph.path)
        if check_provenance:
            self.assertEqual({'CHEBI', 'HGNC', 'GO', 'MESHD', 'TESTNS2'}, set(graph.namespace_url))
            self.assertEqual({'dbSNP'}, set(graph.namespace_pattern))
            self.assertIn('TESTAN1', graph.annotation_list)
            self.assertIn('TESTAN2', graph.annotation_list)
            self.assertEqual(2, len(graph.annotation_list), msg='Wrong number of locally defined annotations')
            self.assertEqual({'TestRegex'}, set(graph.annotation_pattern))
        for node in graph:
            self.assertIsInstance(node, BaseEntity)
        self.assertEqual(sorted(BEL_THOROUGH_NODES, key=str), sorted(graph, key=str), msg='Nodes not equal')
        self.assertLess(0, graph.number_of_edges())
        for u, v, data in BEL_THOROUGH_EDGES:
            assert_has_edge(self, u, v, graph, permissive=True, **data)
def bel_thorough_reconstituted ( self , graph : BELGraph , check_metadata : bool = True , check_warnings : bool = True , check_provenance : bool = True , check_citation_name : bool = True , check_path : bool = True , ) : self . assertIsNotNone ( graph ) self . assertIsInstance ( graph , BELGraph ) if check_warnings : self . assertEqual ( 0 , len ( graph . warnings ) , msg = 'Document warnings:\n{}' . format ( '\n' . join ( map ( str , graph . warnings ) ) ) ) if check_metadata : self . assertLessEqual ( set ( expected_test_thorough_metadata ) , set ( graph . document ) ) self . assertEqual ( expected_test_thorough_metadata [ METADATA_NAME ] , graph . name ) self . assertEqual ( expected_test_thorough_metadata [ METADATA_VERSION ] , graph . version ) self . assertEqual ( expected_test_thorough_metadata [ METADATA_DESCRIPTION ] , graph . description ) if check_path : self . assertEqual ( test_bel_thorough , graph . path ) if check_provenance : self . assertEqual ( { 'CHEBI' , 'HGNC' , 'GO' , 'MESHD' , 'TESTNS2' } , set ( graph . namespace_url ) ) self . assertEqual ( { 'dbSNP' } , set ( graph . namespace_pattern ) ) self . assertIn ( 'TESTAN1' , graph . annotation_list ) self . assertIn ( 'TESTAN2' , graph . annotation_list ) self . assertEqual ( 2 , len ( graph . annotation_list ) , msg = 'Wrong number of locally defined annotations' ) self . assertEqual ( { 'TestRegex' } , set ( graph . annotation_pattern ) ) for node in graph : self . assertIsInstance ( node , BaseEntity ) self . assertEqual ( sorted ( BEL_THOROUGH_NODES , key = str ) , sorted ( graph , key = str ) , msg = 'Nodes not equal' ) self . assertLess ( 0 , graph . number_of_edges ( ) ) for u , v , data in BEL_THOROUGH_EDGES : assert_has_edge ( self , u , v , graph , permissive = True , ** data )
Check that thorough.bel was loaded properly.
Check that thorough . bel was loaded properly .
"""Check that thorough.bel was loaded properly.

        :param graph: A BEL graph
        :param check_metadata: Check the graph's document section is correct
        :param check_warnings: Check the graph produced the expected warnings
        :param check_provenance: Check the graph's definition section is correct
        :param check_citation_name: Check that the names in the citations get reconstituted. This isn't strictly
                                         necessary since this data can be looked up
        :param check_path: Check the graph contains provenance for its original file
        """ # FIXME # self.assertEqual(set((u, v) for u, v, _ in e), set(g.edges()))
self
graph
BELGraph
A BEL graph
A BEL graph
check_metadata
bool
Check the graph's document section is correct
Check the graph ' s document section is correct
check_warnings
bool
Check the graph produced the expected warnings
Check the graph produced the expected warnings
check_provenance
bool
Check the graph's definition section is correct
Check the graph ' s definition section is correct
check_citation_name
bool
Check that the names in the citations get reconstituted. This isn't strictly
necessary since this data can be looked up
Check that the names in the citations get reconstituted . This isn ' t strictly necessary since this data can be looked up
check_path
bool
Check the graph contains provenance for its original file
Check the graph contains provenance for its original file