Passed
Push — master ( db49f2...b2e640 )
by Fernando
01:27
created

tests.transforms.augmentation.test_oneof   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 8

4 Methods

Rating   Name   Duplication   Size   Complexity  
A TestOneOf.test_wrong_input_type() 0 3 2
A TestOneOf.test_negative_probabilities() 0 3 2
A TestOneOf.test_zero_probabilities() 0 3 2
A TestOneOf.test_not_transform() 0 3 2
1
import torchio
0 ignored issues
show
Unused Code introduced by
The import torchio seems to be unused.
Loading history...
2
from torchio.transforms import OneOf, RandomAffine, RandomElasticDeformation
3
from ...utils import TorchioTestCase
4
5
6
class TestOneOf(TorchioTestCase):
7
    """Tests for `OneOf`."""
8
    def test_wrong_input_type(self):
9
        with self.assertRaises(ValueError):
10
            OneOf(1)
11
12
    def test_negative_probabilities(self):
13
        with self.assertRaises(ValueError):
14
            OneOf({RandomAffine(): -1, RandomElasticDeformation(): 1})
15
16
    def test_zero_probabilities(self):
17
        with self.assertRaises(ValueError):
18
            OneOf({RandomAffine(): 0, RandomElasticDeformation(): 0})
19
20
    def test_not_transform(self):
21
        with self.assertRaises(ValueError):
22
            OneOf({RandomAffine: 1, RandomElasticDeformation: 2})
23