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

TestOneOf.test_zero_probabilities()   A

Complexity

Conditions 2

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
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