code: def test_partition_size_in_edge_based_graph_partitioner(
      edge_graph_partitioner,
  ):
      partitioner, data, k = edge_graph_partitioner
      expected_size = data.get_data_size() // k
      allowable_sizes = [
          x
          for y in [
              (expected_size - i, expected_size + i) for i in range(k)
          ]
          for x in y
      ]
      for partition in partitioner:
          actual = partition.get_data_size()
          assert (
              actual in allowable_sizes
          ), "Partition size is not allowed, expected {} +- (0,{}), actual {}.".format(
              expected_size, k, actual
          )
  
imports: import pytest
  from ampligraph.datasets.graph_partitioner import AbstractGraphPartitioner, RandomVerticesGraphPartitioner, RandomEdgesGraphPartitioner, SortedEdgesGraphPartitioner, NaiveGraphPartitioner, DoubleSortedEdgesGraphPartitioner, get_number_of_partitions, PARTITION_ALGO_REGISTRY, GraphDataLoader
  import numpy
  import pandas
  from scipy import special
  from itertools import permutations
  import os
label_desc: Use image node_id 9 for calling a global function with example usage: test_partition_size_in_edge_based_graph_partitioner(edge_graph_partitioner) without return types