def test_update_network_containing_all_types(self):
        updator = NodeLocationUpdator()
        net = NiceCXNetwork()

        comp_attr = NodeLocationUpdator.LOCATION
        no_attr = net.create_node('somenode', node_represents='rep1')

        e_attr = net.create_node('somenode2',
                                 node_represents='uniprot:rep2')
        net.set_node_attribute(e_attr,
                               NodeLocationUpdator.LOCATION,
                               '')

        o_attr = net.create_node('somenode2',
                                 node_represents='uniprot:rep2')
        net.set_node_attribute(o_attr,
                               NodeLocationUpdator.LOCATION,
                               'blah')

        ph_attr = net.create_node('anothernode', node_represents='rep3')

        net.set_node_attribute(ph_attr,
                               NodeLocationUpdator.LOCATION,
                               NodeLocationUpdator.PHENOTYPESLIST)

        self.assertEqual([],
                         updator.update(net))

        self.assertEqual(NodeLocationUpdator.CYTOPLASM,
                         net.get_node_attribute(no_attr, comp_attr)['v'])

        self.assertEqual(NodeLocationUpdator.CYTOPLASM,
                         net.get_node_attribute(e_attr, comp_attr)['v'])

        self.assertEqual('blah',
                         net.get_node_attribute(o_attr, comp_attr)['v'])

        self.assertEqual('',
                         net.get_node_attribute(ph_attr, comp_attr)['v'])
Exemplo n.º 2
0
 def test_update_network_empty(self):
     updator = NodeLocationUpdator()
     net = NiceCXNetwork()
     self.assertEqual([], updator.update(net))
Exemplo n.º 3
0
 def test_update_network_is_none(self):
     updator = NodeLocationUpdator()
     self.assertEqual(['network is None'], updator.update(None))
Exemplo n.º 4
0
 def test_get_description(self):
     updator = NodeLocationUpdator()
     self.assertEqual(
         'Replace any empty node location attribute '
         'values with cytoplasm', updator.get_description())