Ejemplo n.º 1
0
 def test_Pipeline(self):
     from niprov.formatsimple import SimpleFormat
     pipeline = Mock()
     tree = {'raw.f':{'1a.f':{'2.f':{}},'1b.f':{}}}
     exp = ''
     exp += '+---raw.f\n'
     exp += '|   +---1a.f\n'
     exp += '|   |   +---2.f\n'
     exp += '|   +---1b.f\n'
     pipeline.asFilenameTree.return_value = tree
     exporter = SimpleFormat()
     out = exporter.serializePipeline(pipeline)
     self.assertEqual(exp, out)
Ejemplo n.º 2
0
 def test_Pipeline(self):
     from niprov.formatsimple import SimpleFormat
     pipeline = Mock()
     tree = {'raw.f': {'1a.f': {'2.f': {}}, '1b.f': {}}}
     exp = ''
     exp += '+---raw.f\n'
     exp += '|   +---1a.f\n'
     exp += '|   |   +---2.f\n'
     exp += '|   +---1b.f\n'
     pipeline.asFilenameTree.return_value = tree
     exporter = SimpleFormat()
     out = exporter.serializePipeline(pipeline)
     self.assertEqual(exp, out)
Ejemplo n.º 3
0
 def create(self, formatName):
     if formatName == 'json':
         return JsonFormat(self.dependencies)
     if formatName == 'xml':
         return XmlFormat(self.dependencies)
     if formatName == 'narrated':
         return NarratedFormat()
     if formatName == 'simple':
         return SimpleFormat()
     if formatName == 'dict':
         return DictFormat()
     if formatName == 'object':
         return ObjectFormat()
     if formatName == 'picture':
         return PictureCache(self.dependencies)
     raise ValueError('Unknown format: ' + str(formatName))
Ejemplo n.º 4
0
 def test_Statistics(self):
     from niprov.formatsimple import SimpleFormat
     exporter = SimpleFormat()
     out = exporter.serializeStatistics({'count':123,'totalsize':678})
     self.assertIn(' Number of files: 123', out)
     self.assertIn(' Total file size: 678', out)
Ejemplo n.º 5
0
 def test_SerializeSingle(self):
     from niprov.formatsimple import SimpleFormat
     exporter = SimpleFormat()
     out = exporter.serializeSingle(self.aFile())
     self.assertIn('a:                       b\n', out)
Ejemplo n.º 6
0
 def test_Statistics(self):
     from niprov.formatsimple import SimpleFormat
     exporter = SimpleFormat()
     out = exporter.serializeStatistics({'count': 123, 'totalsize': 678})
     self.assertIn(' Number of files: 123', out)
     self.assertIn(' Total file size: 678', out)
Ejemplo n.º 7
0
 def test_SerializeSingle(self):
     from niprov.formatsimple import SimpleFormat
     exporter = SimpleFormat()
     out = exporter.serializeSingle(self.aFile())
     self.assertIn('a:                       b\n', out)