diff --git a/dimod/sampleset.py b/dimod/sampleset.py
index 682aac68..70e3795f 100644
--- a/dimod/sampleset.py
+++ b/dimod/sampleset.py
@@ -21,6 +21,8 @@ of NumPy's array_like_ to allow for arbitrary variable labels.
     like-objects-to-numpy-arrays
 
 """
+import itertools
+
 from collections import Iterable, Sized, Mapping, Iterator
 from collections import namedtuple
 

Missing itertools import
**Description**

Missing itertools import in `sampleset.py`

https://github.com/dwavesystems/dimod/blob/30c9b5a8bc289aee9b276a4ebc2ce27e8413e2f9/dimod/sampleset.py#L517

**Steps To Reproduce**
```
resp.samples(n=1)
```


diff --git a/tests/test_sampleset.py b/tests/test_sampleset.py
index 0e952b2e..2c2b8be4 100644
--- a/tests/test_sampleset.py
+++ b/tests/test_sampleset.py
@@ -83,6 +83,11 @@ class TestSampleSet(unittest.TestCase):
         self.assertNotEqual(ss0, ss2)
         self.assertNotEqual(ss1, ss3)
 
+    def test_shorter_samples(self):
+        ss = dimod.SampleSet.from_samples(np.ones((100, 5), dtype='int8'), dimod.BINARY, energy=np.ones(100))
+
+        self.assertEqual(len(list(ss.samples(n=1))), 1)
+
 
 class TestSampleSetSerialization(unittest.TestCase):
 

pip install -e .[all]
parse_log_pytest
requirements.txt
pytest coverage
apt-get update apt-get install -y gcc libboost-dev
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
codecov==2.1.13
coverage==6.2
Cython==3.0.12
decorator==5.1.1
-e git+https://github.com/dwavesystems/dimod.git@30c9b5a8bc289aee9b276a4ebc2ce27e8413e2f9#egg=dimod
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
jsonschema==2.6.0
mock==2.0.0
networkx==2.0
numpy==1.15.0
packaging==21.3
pandas==0.22.0
pbr==6.1.1
pluggy==1.0.0
py==1.11.0
pymongo==3.7.1
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
requests==2.27.1
six==1.11.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0

name: dimod
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - charset-normalizer==2.0.12
      - codecov==2.1.13
      - coverage==6.2
      - cython==3.0.12
      - decorator==5.1.1
      - idna==3.10
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - jsonschema==2.6.0
      - mock==2.0.0
      - networkx==2.0
      - numpy==1.15.0
      - packaging==21.3
      - pandas==0.22.0
      - pbr==6.1.1
      - pluggy==1.0.0
      - py==1.11.0
      - pymongo==3.7.1
      - pyparsing==3.1.4
      - pytest==7.0.1
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - requests==2.27.1
      - six==1.11.0
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - zipp==3.6.0
prefix: /opt/conda/envs/dimod

tests/test_sampleset.py::TestSampleSet::test_shorter_samples
tests/test_sampleset.py::TestSampleSet::test_eq_ordered tests/test_sampleset.py::TestSampleSet::test_from_samples tests/test_sampleset.py::TestSampleSet::test_from_samples_iterator tests/test_sampleset.py::TestSampleSet::test_from_samples_single_sample tests/test_sampleset.py::TestSampleSet::test_from_samples_str_labels tests/test_sampleset.py::TestSampleSetSerialization::test_functional_json tests/test_sampleset.py::TestSampleSetSerialization::test_functional_simple_shapes tests/test_sampleset.py::TestSampleSetSerialization::test_functional_str
dimod/sampleset.py
dimod/sampleset.py