| Total Complexity | 4 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| 1 | from unittest import TestCase |
||
| 5 | class SimpleFormatTests(TestCase): |
||
| 6 | |||
| 7 | def test_Statistics(self): |
||
| 8 | from niprov.formatsimple import SimpleFormat |
||
| 9 | exporter = SimpleFormat() |
||
| 10 | out = exporter.serializeStatistics({'count':123,'totalsize':678}) |
||
| 11 | self.assertIn(' Number of files: 123', out) |
||
| 12 | self.assertIn(' Total file size: 678', out) |
||
| 13 | |||
| 14 | def test_Pipeline(self): |
||
| 15 | from niprov.formatsimple import SimpleFormat |
||
| 16 | pipeline = Mock() |
||
| 17 | tree = {'raw.f':{'1a.f':{'2.f':{}},'1b.f':{}}} |
||
| 18 | exp = '' |
||
| 19 | exp += '+---raw.f\n' |
||
| 20 | exp += '| +---1a.f\n' |
||
| 21 | exp += '| | +---2.f\n' |
||
| 22 | exp += '| +---1b.f\n' |
||
| 23 | pipeline.asFilenameTree.return_value = tree |
||
| 24 | exporter = SimpleFormat() |
||
| 25 | out = exporter.serializePipeline(pipeline) |
||
| 26 | self.assertEqual(exp, out) |
||
| 27 | |||
| 28 | def test_SerializeSingle(self): |
||
| 29 | from niprov.formatsimple import SimpleFormat |
||
| 30 | exporter = SimpleFormat() |
||
| 31 | out = exporter.serializeSingle(self.aFile()) |
||
| 32 | self.assertIn('a: b\n', out) |
||
| 33 | |||
| 34 | def aFile(self): |
||
| 35 | somefile = Mock() |
||
| 36 | somefile.provenance = {'a':'b'} |
||
| 37 | return somefile |
||
| 38 | |||
| 39 |