code: def test_sample_users_frac():
      ratings = lktu.ml_test.ratings
      splits = xf.sample_users(ratings, 5, 100, xf.SampleFrac(0.2))
      splits = list(splits)
      assert len(splits) == 5
      ucounts = ratings.groupby("user").item.count()
      uss = ucounts * 0.2
  
      for s in splits:
          tucs = s.test.groupby("user").item.count()
          assert len(tucs) == 100
          assert all(tucs >= uss.loc[tucs.index] - 1)
          assert all(tucs <= uss.loc[tucs.index] + 1)
          assert all(s.test.index.union(s.train.index) == ratings.index)
          assert len(s.test) + len(s.train) == len(ratings)
  
      # no overlapping users
      for s1, s2 in it.product(splits, splits):
          if s1 is s2:
              continue
          us1 = s1.test.user.unique()
          us2 = s2.test.user.unique()
          assert len(np.intersect1d(us1, us2)) == 0
  
imports: import itertools
  import functools
  import pytest
  import math
  import numpy
  import lenskit.util.test
  import lenskit.crossfold
label_desc: Use image node_id 14 for calling a global function with example usage: test_sample_users_frac() without return types