| Total Complexity | 8 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | #!/usr/bin/env python |
||
| 2 | |||
| 3 | """Tests for Subject.""" |
||
| 4 | |||
| 5 | import tempfile |
||
| 6 | from torchio import INTENSITY, Subject, Image, RandomFlip |
||
| 7 | from ..utils import TorchioTestCase |
||
| 8 | |||
| 9 | |||
| 10 | class TestSubject(TorchioTestCase): |
||
| 11 | """Tests for `Subject`.""" |
||
| 12 | def test_positional_args(self): |
||
| 13 | with self.assertRaises(ValueError): |
||
| 14 | with tempfile.NamedTemporaryFile() as f: |
||
|
|
|||
| 15 | Subject(Image(f.name, INTENSITY)) |
||
| 16 | |||
| 17 | def test_input_dict(self): |
||
| 18 | with tempfile.NamedTemporaryFile() as f: |
||
| 19 | input_dict = {'image': Image(f.name, INTENSITY)} |
||
| 20 | Subject(input_dict) |
||
| 21 | Subject(**input_dict) |
||
| 22 | |||
| 23 | def test_no_sample(self): |
||
| 24 | with tempfile.NamedTemporaryFile() as f: |
||
| 25 | input_dict = {'image': Image(f.name, INTENSITY)} |
||
| 26 | subject = Subject(input_dict) |
||
| 27 | with self.assertRaises(RuntimeError): |
||
| 28 | RandomFlip()(subject) |
||
| 29 |
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.