Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.pipelines
Commits
17f77d5a
Commit
17f77d5a
authored
Apr 06, 2020
by
Tiago de Freitas Pereira
Browse files
Break the link between SampleSet and Sample
parent
03f9de2a
Pipeline
#38738
failed with stage
in 3 minutes and 25 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/pipelines/sample.py
View file @
17f77d5a
...
...
@@ -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
)
bob/pipelines/test/test_samples.py
View file @
17f77d5a
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment