for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
#!/usr/bin/env python
"""Tests for Subject."""
import tempfile
from torchio import INTENSITY, Subject, Image, RandomFlip
from ..utils import TorchioTestCase
class TestSubject(TorchioTestCase):
"""Tests for `Subject`."""
def test_positional_args(self):
with self.assertRaises(ValueError):
with tempfile.NamedTemporaryFile() as f:
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.
Subject(Image(f.name, INTENSITY))
def test_input_dict(self):
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;
input_dict = {'image': Image(f.name, INTENSITY)}
Subject(input_dict)
Subject(**input_dict)
def test_no_sample(self):
subject = Subject(input_dict)
with self.assertRaises(RuntimeError):
RandomFlip()(subject)
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.