code: def test_number_of_partitions_after_graph_partitioning(
      graph_partitioner,
  ):
      n_parts = len(graph_partitioner[0].partitions)
      # BucketGraph return k*(k+1)/2 partitions
      # RandomVertices will return k or less than k partitions depending on the vertex splits.
      if graph_partitioner[0].__class__.__name__ in [
          "BucketGraphPartitioner",
          "RandomVerticesGraphPartitioner",
      ]:
          expected = get_number_of_partitions(graph_partitioner[1])
          assert (
              n_parts <= expected
          ), "{}: Requested number of partitions based on buckets should be greater or equal to the actual, expected max of {} got {}".format(
              graph_partitioner[0].__class__.__name__, expected, n_parts
          )
      else:
          assert (
              n_parts == graph_partitioner[1]
          ), "{}: Requested number of partitions not equal to the actual should be {} got {}".format(
              graph_partitioner[0].__class__.__name__,
              graph_partitioner[1],
              n_parts,
          )
  
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 8 for calling a global function with example usage: test_number_of_partitions_after_graph_partitioning(graph_partitioner) without return types