code: def test_split_data_local(self, cora):
      g, es_obj = cora
      p = 0.1
      # using default sampling probabilities
      (
          g_test,
          edge_data_ids_test,
          edge_data_labels_test,
      ) = es_obj.train_test_split(
          p=p, method="local", keep_connected=True
      )
  
      # if all goes well, what are the expected return values?
      num_sampled_positives = np.sum(edge_data_labels_test == 1)
      num_sampled_negatives = np.sum(edge_data_labels_test == 0)
  
      assert num_sampled_positives > 0
      assert num_sampled_negatives > 0
      assert len(edge_data_ids_test) == len(edge_data_labels_test)
      assert (num_sampled_positives - num_sampled_negatives) == 0
      assert len(g_test.edges()) < len(g.edges())
      assert nx.is_connected(g_test)
  
      sampling_probs = [0.0, 0.0, 0.1, 0.2, 0.5, 0.2]
      (
          g_test,
          edge_data_ids_test,
          edge_data_labels_test,
      ) = es_obj.train_test_split(
          p=p, method="local", probs=sampling_probs, keep_connected=True
      )
  
      num_sampled_positives = np.sum(edge_data_labels_test == 1)
      num_sampled_negatives = np.sum(edge_data_labels_test == 0)
  
      assert num_sampled_positives > 0
      assert num_sampled_negatives > 0
      assert len(edge_data_ids_test) == len(edge_data_labels_test)
      assert (num_sampled_positives - num_sampled_negatives) == 0
      assert len(g_test.edges()) < len(g.edges())
      assert nx.is_connected(g_test)
  
      with pytest.raises(ValueError):
          # This should raise ValueError because it is asking for more positive samples that are available
          # without breaking graph connectivity
          es_obj.train_test_split(
              p=0.8,
              method="local",
              probs=sampling_probs,
              keep_connected=True,
          )
  
      sampling_probs = [
          0.2,
          0.1,
          0.2,
          0.5,
          0.2,
      ]  # values don't sum to 1
      with pytest.raises(ValueError):
          es_obj.train_test_split(
              p=p, method="local", probs=sampling_probs
          )
  
imports: import pytest
  import os
  import numpy
  import networkx
  from stellargraph import StellarGraph
  from stellargraph.data.edge_splitter import EdgeSplitter
  from stellargraph.data.epgm import EPGM
  import random
  import datetime
  from datetime import datetime, timedelta
  from ..test_utils import flaky_xfail_mark
  from ..test_utils.graphs import example_graph_random
label_desc: Use image node_id 2 for calling the TestEdgeSplitterHomogeneous obj's underlying member method code with example usage: obj.test_split_data_local(cora) without return types