Passed
Pull Request — master (#175)
by Fernando
01:02
created

tests.data.sampler.test_label_sampler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 13
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A TestLabelSampler.test_label_sampler() 0 4 2
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