Passed
Push — master ( 0d2a88...eb3c35 )
by Fernando
01:36
created

tests.transforms.preprocessing.test_crop   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A TestCrop.test_tensor_multi_channel() 0 3 1
A TestCrop.test_tensor_single_channel() 0 3 1
1
import torch
2
from torchio.transforms import Crop
3
from ...utils import TorchioTestCase
4
5
6
class TestCrop(TorchioTestCase):
7
    """Tests for `Crop`."""
8
    def test_tensor_single_channel(self):
9
        crop = Crop(1)
10
        self.assertEqual(crop(torch.rand(1, 10, 10, 10)).shape, (1, 8, 8, 8))
11
12
    def test_tensor_multi_channel(self):
13
        crop = Crop(1)
14
        self.assertEqual(crop(torch.rand(3, 10, 10, 10)).shape, (3, 8, 8, 8))
15