code: def test_sampler():
      batch_size = 8
      maxlen = 50
      data_dir = os.path.join("tests", "resources", "deeprec", "sasrec")
      dataset = "reviews_Electronics_5"
      reviews_name = dataset + ".json"
      outfile = os.path.join(data_dir, dataset + ".txt")
  
      reviews_file = os.path.join(data_dir, reviews_name)
      download_and_extract(reviews_name, reviews_file)
      reviews_output = _reviews_preprocessing(reviews_file)
      _, _ = data_process_with_time(
          reviews_output, outfile, K=10, sep="\t"
      )
  
      # initiate a dataset class
      data = SASRecDataSet(filename=outfile, col_sep="\t")
  
      # create train, validation and test splits
      data.split()
  
      sampler = WarpSampler(
          data.user_train,
          data.usernum,
          data.itemnum,
          batch_size=batch_size,
          maxlen=maxlen,
          n_workers=3,
      )
      u, seq, pos, neg = sampler.next_batch()
  
      assert len(u) == batch_size
      assert len(seq) == batch_size
      assert len(pos) == batch_size
      assert len(neg) == batch_size
  
file_path: recommenders/tests/unit/recommenders/models/test_sasrec_model.py
imports: import os
  import pytest
  from collections import defaultdict
label_desc: Use image node_id 4 for calling a global function with example usage: test_sampler() without return types