Passed
Pull Request — master (#115)
by Fernando
01:25
created

TestSubject.test_duplicate_image_name()   A

Complexity

Conditions 3

Size

Total Lines 8
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 3
nop 1
1
#!/usr/bin/env python
2
3
"""Tests for Subject."""
4
5
import tempfile
6
from torchio import INTENSITY, Subject, Image
7
from ..utils import TorchioTestCase
8
9
10
class TestSubject(TorchioTestCase):
11
    """Tests for `Subject`."""
12
    def test_positional_args(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
13
        with self.assertRaises(ValueError):
14
            with tempfile.NamedTemporaryFile() as f:
0 ignored issues
show
Coding Style Naming introduced by
Variable name "f" doesn't conform to snake_case naming style ('(([a-z_][a-z0-9_]2,)|(_[a-z0-9_]*)|(__[a-z][a-z0-9_]+__))$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
15
                Subject(Image(f.name, INTENSITY))
16
17
    def test_input_dict(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
18
        with tempfile.NamedTemporaryFile() as f:
0 ignored issues
show
Coding Style Naming introduced by
Variable name "f" doesn't conform to snake_case naming style ('(([a-z_][a-z0-9_]2,)|(_[a-z0-9_]*)|(__[a-z][a-z0-9_]+__))$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
19
            input_dict = {'image': Image(f.name, INTENSITY)}
20
            Subject(**input_dict)
21