code: def test_all_data_loaders_output_equal(
      df_for_interactions, hdf5_pandas_df_path, tmpdir, capfd
  ):
      common_data_loader_kwargs = {
          "num_negative_samples": 4,
          "batch_size": 5,
          "shuffle": False,
          "drop_last": False,
      }
  
      interactions_dl = InteractionsDataLoader(
          users=df_for_interactions["user_id"],
          items=df_for_interactions["item_id"],
          **common_data_loader_kwargs,
      )
      approx_dl = ApproximateNegativeSamplingInteractionsDataLoader(
          users=df_for_interactions["user_id"],
          items=df_for_interactions["item_id"],
          **common_data_loader_kwargs,
      )
      hdf5_interactions_dl = HDF5InteractionsDataLoader(
          hdf5_path=hdf5_pandas_df_path,
          user_col="user_id",
          item_col="item_id",
          **common_data_loader_kwargs,
      )
  
      expected_repr = (
          "{} object with 12 interactions between 6 users and 10 items, returning 4 negative samples"
          " per implicit interaction in non-shuffled batches of size 5."
      )
  
      assert str(interactions_dl) == expected_repr.format(
          str(type(interactions_dl).__name__)
      )
      assert str(approx_dl) == expected_repr.format(
          str(type(approx_dl).__name__)
      )
      assert str(hdf5_interactions_dl) == expected_repr.format(
          str(type(hdf5_interactions_dl).__name__)
      )
  
      assert (
          interactions_dl.num_users
          == approx_dl.num_users
          == hdf5_interactions_dl.num_users
      )
      assert (
          interactions_dl.num_items
          == approx_dl.num_items
          == hdf5_interactions_dl.num_items
      )
      assert (
          interactions_dl.num_interactions
          == approx_dl.num_interactions
          == hdf5_interactions_dl.num_interactions
      )
  
      # get all batches from every DataLoader, add them to a list for comparison below
      def get_all_batches_from_DataLoader(dataloader, batch_size):
          all_batches = list()
          for idx, batch in enumerate(dataloader):
              assert (
                  len(batch[0][0]) == len(batch[0][1]) == len(batch[1])
              )
  
              if idx < len(dataloader) - 1:
                  assert len(batch[0][0]) == batch_size
  
              all_batches.append(batch)
  
          return all_batches
  
      interactions_batches = get_all_batches_from_DataLoader(
          interactions_dl, batch_size=interactions_dl.batch_size
      )
      approximate_batches = get_all_batches_from_DataLoader(
          approx_dl,
          batch_size=approx_dl.approximate_negative_sampler.batch_size,
      )
      hdf5_batches = get_all_batches_from_DataLoader(
          hdf5_interactions_dl,
          batch_size=hdf5_interactions_dl.hdf5_sampler.batch_size,
      )
  
      for idx in range(len(interactions_batches)):
          assert (
              interactions_batches[idx][0][0].tolist()
              == approximate_batches[idx][0][0].tolist()
              == hdf5_batches[idx][0][0].tolist()
          )
          assert (
              interactions_batches[idx][0][1].tolist()
              == approximate_batches[idx][0][1].tolist()
              == hdf5_batches[idx][0][1].tolist()
          )
          # random negative samples will never be exactly equal
          assert (
              interactions_batches[idx][1].shape
              == approximate_batches[idx][1].shape
              == hdf5_batches[idx][1].shape
          )
  
      # test that our last batch is less than the specified batch size and that is okay for HDF5 data
      assert (
          len(interactions_batches[-1][0][0])
          < interactions_dl.batch_size
      )
      assert (
          len(approximate_batches[-1][0][0])
          < approx_dl.approximate_negative_sampler.batch_size
      )
      assert (
          len(hdf5_batches[-1][0][0])
          < hdf5_interactions_dl.hdf5_sampler.batch_size
      )
  
      # ensure that the format for implicit data is:
      # ``((X, Y), Z) = ((user IDs, item IDs), negative item IDs)``
      assert (
          len(interactions_batches[0][0])
          == len(approximate_batches[0][0])
          == len(hdf5_batches[0][0])
          == 2
      )
      assert (
          len(interactions_batches[0])
          == len(approximate_batches[0])
          == len(hdf5_batches[0])
          == 2
      )
  
imports: import sys
  import numpy
  import pandas
  import pytest
  from collie.interactions import ApproximateNegativeSamplingInteractionsDataLoader, ExplicitInteractions, HDF5Interactions, HDF5InteractionsDataLoader, Interactions, InteractionsDataLoader
label_desc: Use image node_id 12 for calling a global function with example usage: test_all_data_loaders_output_equal(df_for_interactions, hdf5_pandas_df_path, tmpdir, capfd) and returns: all_batches