Passed
Pull Request — master (#133)
by Fernando
01:29
created

tests.data.test_image   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 6

3 Methods

Rating   Name   Duplication   Size   Complexity  
A TestImage.test_image_not_found() 0 3 2
A TestImage.test_wrong_path_type() 0 3 2
A TestImage.test_bad_key() 0 3 2
1
#!/usr/bin/env python
2
3
"""Tests for Image."""
4
5
from torchio import INTENSITY, Image
6
from ..utils import TorchioTestCase
7
8
9
class TestImage(TorchioTestCase):
10
    """Tests for `Image`."""
11
12
    def test_image_not_found(self):
13
        with self.assertRaises(FileNotFoundError):
14
            Image('nopath', INTENSITY)
15
16
    def test_wrong_path_type(self):
17
        with self.assertRaises(TypeError):
18
            Image(5, INTENSITY)
19
20
    def test_bad_key(self):
21
        with self.assertRaises(ValueError):
22
            Image(5, INTENSITY, affine=1)
23