def test_setup_influence_edges_bulk_wont_overwrite_existing_influences(self):
        """
        Test that setup_influence_edges_bulk will not overwrite existing
        influence edges.
        """
        with patch('network_utils.influence') as mock:
            mock.return_value = 0.5
            self.network = setup_influence_edges_bulk(self.network)
            edges = get_edges_by_type(self.network, "influence")
            self.assertEqual(len(edges), 20)
            for e in edges:
                self.assertEqual(self.network.get_edge_data(
                    e[0], e[1])["influence"], 0.5)

            mock.return_value = 0.8
            self.network = setup_influence_edges_bulk(self.network)
            edges = get_edges_by_type(self.network, "influence")
            self.assertEqual(len(edges), 20)
            for e in edges:
                self.assertEqual(self.network.get_edge_data(
                    e[0], e[1])["influence"], 0.5)
 def test_setup_influence_edges_bulk(self):
     """
     Test that the code works, and that edges are created between DIFFERENT
     nodes. Also ensures that edges refer to the node index, not the Participant
     object stored within the node.
     """
     with patch('network_utils.influence') as mock:
         mock.return_value = 0.5
         self.network = setup_influence_edges_bulk(self.network)
         edges = get_edges_by_type(self.network, "influence")
         self.assertEqual(len(edges), 20)
         for e in edges:
             self.assertIsInstance(e[0], int)
             self.assertIsInstance(e[1], int)
             self.assertNotEqual(e[0], e[1])