ndexbio / ndex2-client

NDEx2 Client
BSD 3-Clause "New" or "Revised" License
6 stars 6 forks source link

NiceCXNetwork.create_edge fails to correctly create edge when node dict passed in #46

Closed coleslaw481 closed 5 years ago

coleslaw481 commented 5 years ago

Running this unit test fails cause the code in NiceCXNetwork.create_edge() does not check if value of edge_source and edge_target contain a dict which denotes its a node dict and '@id' should be examined:

    def test_create_edge_with_node_dict_passed_in_for_edge_ids(self):
        net = NiceCXNetwork()

        nodeone = net.get_node(net.create_node('node1'))
        nodetwo = net.get_node(net.create_node('node2'))
        net.create_edge(edge_source=nodeone, edge_target=nodetwo)
        res = net.get_edge(0)
        self.assertEqual(0, res['@id'])
        self.assertEqual(0, res['s'])
        self.assertEqual(1, res['t'])

The res from above currently returns as:

{'@id': 0, 'n': 'node1', 'r': 'node1'}
coleslaw481 commented 5 years ago

Fixed in chrisdev3.1.0 branch