code: def test_masking_text_sampler_length(text, n_samples, bow):
      sampler = MaskingTextSampler(bow=bow)
      sampler.fit([text])
  
      samples, sims = sampler.sample_near(text, n_samples=n_samples)
      assert len(samples) == n_samples
      assert sims.shape == (n_samples,)
      assert all(len(s) <= len(text) for s in samples)
  
file_path: eli5/tests/test_samplers.py
imports: from functools import partial
  import numpy
  import pytest
  from hypothesis import given
  from hypothesis.strategies import integers, text
  from eli5.lime.samplers import MaskingTextSampler, MaskingTextSamplers, UnivariateKernelDensitySampler, MultivariateKernelDensitySampler
  from sklearn.neighbors import KernelDensity
label_desc: Use image node_id 1 for calling a global function with example usage: test_masking_text_sampler_length(text, n_samples, bow) without return types