Break the link between SampleSet and Sample

parent 03f9de2a
Pipeline #38738 failed with stage
in 3 minutes and 25 seconds
......@@ -93,18 +93,11 @@ class SampleSet(MutableSequence):
return self.samples.__getitem__(item)
def __setitem__(self, key, item):
if not isinstance(item, Sample) and not isinstance(item, DelayedSample):
raise ValueError(f"item should be of type Sample, not {item}")
return self.samples.__setitem__(key, item)
def __delitem__(self, item):
return self.samples.__delitem__(item)
def insert(self, index, item):
if not isinstance(item, Sample) and not isinstance(item, DelayedSample):
raise ValueError(f"item should be of type Sample, not {item}")
# if not item in self.samples:
self.samples.insert(index, item)
from bob.pipelines.sample import Sample, SampleSet, DelayedSample
import numpy
from nose.tools import assert_raises
import copy
......@@ -23,17 +22,9 @@ def test_sampleset_collection():
del sampleset[0]
assert len(sampleset) == n_samples
# Testing exception
with assert_raises(ValueError):
sampleset.insert(1, 10)
# Testing set
sampleset[0] = copy.deepcopy(sample)
# Testing exception
with assert_raises(ValueError):
sampleset[0] = "xuxa"
# Testing iterator
for i in sampleset:
assert isinstance(i, Sample)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment