tests/constants.py
def bel_simple_reconstituted(self, graph: BELGraph, check_metadata: bool = True):
        """Check that test_bel.bel was loaded properly."""
        self.assertIsNotNone(graph)
        self.assertIsInstance(graph, BELGraph)

        if check_metadata:
            self.assertIsNotNone(graph.document)
            self.assertEqual(expected_test_simple_metadata[METADATA_NAME], graph.name)
            self.assertEqual(expected_test_simple_metadata[METADATA_VERSION], graph.version)

        self.assertEqual(4, graph.number_of_nodes())

        # FIXME this should work, but is getting 8 for the upgrade function
        # self.assertEqual(6, graph.number_of_edges(),
        #                  msg='Edges:\n{}'.format('\n'.join(map(str, graph.edges(keys=True, data=True)))))

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

        self.assertIn(akt1, graph)
        self.assertIn(egfr, graph)
        self.assertIn(fadd, graph)
        self.assertIn(casp8, graph)

        bel_simple_citation_1 = citation_dict(namespace=CITATION_TYPE_PUBMED, identifier="123455")
        bel_simple_citation_2 = citation_dict(namespace=CITATION_TYPE_PUBMED, identifier="123456")

        evidence_1_extra = "Evidence 1 w extra notes"
        evidence_2 = 'Evidence 2'
        evidence_3 = 'Evidence 3'

        assert_has_edge(self, akt1, egfr, graph, only=True, **{
            RELATION: INCREASES,
            CITATION: bel_simple_citation_1,
            EVIDENCE: evidence_1_extra,
            ANNOTATIONS: {
                'Species': [Entity(namespace='Species', identifier='9606')],
            }
        })
        assert_has_edge(self, egfr, fadd, graph, only=True, **{
            RELATION: DECREASES,
            ANNOTATIONS: {
                'Species': [Entity(namespace='Species', identifier='9606')],
                'CellLine': [Entity(namespace='CellLine', identifier='10B9 cell')],
            },
            CITATION: bel_simple_citation_1,
            EVIDENCE: evidence_2
        })
        assert_has_edge(self, egfr, casp8, graph, only=True, **{
            RELATION: DIRECTLY_DECREASES,
            ANNOTATIONS: {
                'Species': [Entity(namespace='Species', identifier='9606')],
                'CellLine': [Entity(namespace='CellLine', identifier='10B9 cell')],
            },
            CITATION: bel_simple_citation_1,
            EVIDENCE: evidence_2,
        })
        assert_has_edge(self, fadd, casp8, graph, only=True, **{
            RELATION: INCREASES,
            ANNOTATIONS: {
                'Species': [Entity(namespace='Species', identifier='10116')],
            },
            CITATION: bel_simple_citation_2,
            EVIDENCE: evidence_3,
        })
        assert_has_edge(self, akt1, casp8, graph, only=True, **{
            RELATION: ASSOCIATION,
            ANNOTATIONS: {
                'Species': [Entity(namespace='Species', identifier='10116')],
            },
            CITATION: bel_simple_citation_2,
            EVIDENCE: evidence_3,
        })
        assert_has_edge(self, casp8, akt1, graph, only=True, **{
            RELATION: ASSOCIATION,
            ANNOTATIONS: {
                'Species': [Entity(namespace='Species', identifier='10116')],
            },
            CITATION: bel_simple_citation_2,
            EVIDENCE: evidence_3,
        })
Check that test_bel.bel was loaded properly.
Check that test_bel.bel was loaded properly.
Check that test_bel . bel was loaded properly .
def bel_simple_reconstituted(self, graph: BELGraph, check_metadata: bool = True):
        self.assertIsNotNone(graph)
        self.assertIsInstance(graph, BELGraph)
        if check_metadata:
            self.assertIsNotNone(graph.document)
            self.assertEqual(expected_test_simple_metadata[METADATA_NAME], graph.name)
            self.assertEqual(expected_test_simple_metadata[METADATA_VERSION], graph.version)
        self.assertEqual(4, graph.number_of_nodes())
        for node in graph:
            self.assertIsInstance(node, BaseEntity)
        self.assertIn(akt1, graph)
        self.assertIn(egfr, graph)
        self.assertIn(fadd, graph)
        self.assertIn(casp8, graph)
        bel_simple_citation_1 = citation_dict(namespace=CITATION_TYPE_PUBMED, identifier="123455")
        bel_simple_citation_2 = citation_dict(namespace=CITATION_TYPE_PUBMED, identifier="123456")
        evidence_1_extra = "Evidence 1 w extra notes"
        evidence_2 = 'Evidence 2'
        evidence_3 = 'Evidence 3'
        assert_has_edge(self, akt1, egfr, graph, only=True, **{
            RELATION: INCREASES,
            CITATION: bel_simple_citation_1,
            EVIDENCE: evidence_1_extra,
            ANNOTATIONS: {
                'Species': [Entity(namespace='Species', identifier='9606')],
            }
        })
        assert_has_edge(self, egfr, fadd, graph, only=True, **{
            RELATION: DECREASES,
            ANNOTATIONS: {
                'Species': [Entity(namespace='Species', identifier='9606')],
                'CellLine': [Entity(namespace='CellLine', identifier='10B9 cell')],
            },
            CITATION: bel_simple_citation_1,
            EVIDENCE: evidence_2
        })
        assert_has_edge(self, egfr, casp8, graph, only=True, **{
            RELATION: DIRECTLY_DECREASES,
            ANNOTATIONS: {
                'Species': [Entity(namespace='Species', identifier='9606')],
                'CellLine': [Entity(namespace='CellLine', identifier='10B9 cell')],
            },
            CITATION: bel_simple_citation_1,
            EVIDENCE: evidence_2,
        })
        assert_has_edge(self, fadd, casp8, graph, only=True, **{
            RELATION: INCREASES,
            ANNOTATIONS: {
                'Species': [Entity(namespace='Species', identifier='10116')],
            },
            CITATION: bel_simple_citation_2,
            EVIDENCE: evidence_3,
        })
        assert_has_edge(self, akt1, casp8, graph, only=True, **{
            RELATION: ASSOCIATION,
            ANNOTATIONS: {
                'Species': [Entity(namespace='Species', identifier='10116')],
            },
            CITATION: bel_simple_citation_2,
            EVIDENCE: evidence_3,
        })
        assert_has_edge(self, casp8, akt1, graph, only=True, **{
            RELATION: ASSOCIATION,
            ANNOTATIONS: {
                'Species': [Entity(namespace='Species', identifier='10116')],
            },
            CITATION: bel_simple_citation_2,
            EVIDENCE: evidence_3,
        })
def bel_simple_reconstituted ( self , graph : BELGraph , check_metadata : bool = True ) : self . assertIsNotNone ( graph ) self . assertIsInstance ( graph , BELGraph ) if check_metadata : self . assertIsNotNone ( graph . document ) self . assertEqual ( expected_test_simple_metadata [ METADATA_NAME ] , graph . name ) self . assertEqual ( expected_test_simple_metadata [ METADATA_VERSION ] , graph . version ) self . assertEqual ( 4 , graph . number_of_nodes ( ) ) for node in graph : self . assertIsInstance ( node , BaseEntity ) self . assertIn ( akt1 , graph ) self . assertIn ( egfr , graph ) self . assertIn ( fadd , graph ) self . assertIn ( casp8 , graph ) bel_simple_citation_1 = citation_dict ( namespace = CITATION_TYPE_PUBMED , identifier = "123455" ) bel_simple_citation_2 = citation_dict ( namespace = CITATION_TYPE_PUBMED , identifier = "123456" ) evidence_1_extra = "Evidence 1 w extra notes" evidence_2 = 'Evidence 2' evidence_3 = 'Evidence 3' assert_has_edge ( self , akt1 , egfr , graph , only = True , ** { RELATION : INCREASES , CITATION : bel_simple_citation_1 , EVIDENCE : evidence_1_extra , ANNOTATIONS : { 'Species' : [ Entity ( namespace = 'Species' , identifier = '9606' ) ] , } } ) assert_has_edge ( self , egfr , fadd , graph , only = True , ** { RELATION : DECREASES , ANNOTATIONS : { 'Species' : [ Entity ( namespace = 'Species' , identifier = '9606' ) ] , 'CellLine' : [ Entity ( namespace = 'CellLine' , identifier = '10B9 cell' ) ] , } , CITATION : bel_simple_citation_1 , EVIDENCE : evidence_2 } ) assert_has_edge ( self , egfr , casp8 , graph , only = True , ** { RELATION : DIRECTLY_DECREASES , ANNOTATIONS : { 'Species' : [ Entity ( namespace = 'Species' , identifier = '9606' ) ] , 'CellLine' : [ Entity ( namespace = 'CellLine' , identifier = '10B9 cell' ) ] , } , CITATION : bel_simple_citation_1 , EVIDENCE : evidence_2 , } ) assert_has_edge ( self , fadd , casp8 , graph , only = True , ** { RELATION : INCREASES , ANNOTATIONS : { 'Species' : [ Entity ( namespace = 'Species' , identifier = '10116' ) ] , } , CITATION : bel_simple_citation_2 , EVIDENCE : evidence_3 , } ) assert_has_edge ( self , akt1 , casp8 , graph , only = True , ** { RELATION : ASSOCIATION , ANNOTATIONS : { 'Species' : [ Entity ( namespace = 'Species' , identifier = '10116' ) ] , } , CITATION : bel_simple_citation_2 , EVIDENCE : evidence_3 , } ) assert_has_edge ( self , casp8 , akt1 , graph , only = True , ** { RELATION : ASSOCIATION , ANNOTATIONS : { 'Species' : [ Entity ( namespace = 'Species' , identifier = '10116' ) ] , } , CITATION : bel_simple_citation_2 , EVIDENCE : evidence_3 , } )
Check that test_bel.bel was loaded properly.
Check that test_bel . bel was loaded properly .
"""Check that test_bel.bel was loaded properly.""" # FIXME this should work, but is getting 8 for the upgrade function # self.assertEqual(6, graph.number_of_edges(), #                  msg='Edges:\n{}'.format('\n'.join(map(str, graph.edges(keys=True, data=True)))))
self
graph
BELGraph
check_metadata
bool