code: def test_sample_non_disjoint():
      ratings = lktu.ml_test.ratings
      splits = xf.sample_rows(
          ratings, partitions=10, size=1000, disjoint=False
      )
      splits = list(splits)
      assert len(splits) == 10
  
      for s in splits:
          assert len(s.test) == 1000
          assert len(s.test) + len(s.train) == len(ratings)
          test_idx = s.test.set_index(["user", "item"]).index
          train_idx = s.train.set_index(["user", "item"]).index
          assert len(test_idx.intersection(train_idx)) == 0
  
      # There are enough splits & items we should pick at least one duplicate
      ipairs = (
          (
              s1.test.set_index("user", "item").index,
              s2.test.set_index("user", "item").index,
          )
          for (s1, s2) in it.product(splits, splits)
      )
      isizes = [len(i1.intersection(i2)) for (i1, i2) in ipairs]
      assert any(n > 0 for n in isizes)
  
imports: import itertools
  import functools
  import pytest
  import math
  import numpy
  import lenskit.util.test
  import lenskit.crossfold
label_desc: Use image node_id 4 for calling a global function with example usage: test_sample_non_disjoint() without return types