Passed
Pull Request — master (#175)
by Fernando
58s
created

TestLabelSampler.test_label_sampler()   A

Complexity

Conditions 2

Size

Total Lines 4
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
from torchio import DATA
2
from torchio.data import LabelSampler
3
from ...utils import TorchioTestCase
4
5
6
class TestLabelSampler(TorchioTestCase):
7
    """Tests for `LabelSampler` class."""
8
9
    def test_label_sampler(self):
10
        sampler = LabelSampler(5, 'label')
11
        for patch in sampler(self.sample, num_patches=10):
12
            self.assertEqual(patch['label'][DATA][0, 2, 2, 2], 1)
13