docstr: Ensure every method produces a valid order (contain all pairs once).
  
  Even if it may not be the intended order.
docstr_tok: ["Ensure","every","method","produces","a","valid","order","(","contain","all","pairs","once",")",".","Even","if","it","may","not","be","the","intended","order","."]
code: def test_valid(self) -> None:
      """Ensure every method produces a valid order (contain all pairs once).
  
      Even if it may not be the intended order.
  
      """
      orders = [
          BucketOrder.RANDOM,
          BucketOrder.AFFINITY,
          BucketOrder.INSIDE_OUT,
          BucketOrder.OUTSIDE_IN,
      ]
      shapes = [(4, 4), (3, 5), (6, 1), (1, 6), (1, 1)]
      generator = random.Random()
  
      for order in orders:
          for nparts_lhs, nparts_rhs in shapes:
              seed = random.getrandbits(32)
              with self.subTest(
                  order=order, shape=(nparts_lhs, nparts_rhs), seed=seed
              ):
                  generator.seed(seed)
                  actual_buckets = create_ordered_buckets(
                      nparts_lhs=nparts_lhs,
                      nparts_rhs=nparts_rhs,
                      order=order,
                      generator=generator,
                  )
  
                  self.assertCountEqual(
                      actual_buckets,
                      product(range(nparts_lhs), range(nparts_rhs)),
                  )
  
file_path: PyTorch-BigGraph/test/test_bucket_scheduling.py
imports: import random
  from itertools import product
  from unittest import main, TestCase
  from torchbiggraph.bucket_scheduling import create_ordered_buckets
  from torchbiggraph.config import BucketOrder
label_desc: Use image node_id 1 for calling the TestCreateOrderedBuckets obj's underlying member method code with example usage: obj.test_valid() without return types