| Total Complexity | 8 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import torchio |
||
|
|
|||
| 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 |