Passed
Push — main ( c95fa1...287682 )
by Fernando
01:32
created

tests.transforms.preprocessing.test_to   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A TestTo.test_to() 0 7 1
1
import torch
2
3
import torchio as tio
4
5
from ...utils import TorchioTestCase
6
7
8
class TestTo(TorchioTestCase):
9
    """Tests for :class:`tio.To` class."""
10
11
    def test_to(self):
12
        transform = tio.To(torch.int)
13
        tensor = 10 * torch.rand(2, 3, 4, 5)
14
        image = tio.ScalarImage(tensor=tensor)
15
        transformed = transform(image)
16
        assert image.data.dtype == torch.float32
17
        assert transformed.data.dtype == torch.int
18