Esempio n. 1
0
 def test_many_cases(self):
     """ loop over CASES """
     for num, typ, name in CASES:
         obj = fabio.FilenameObject(filename=name)
         self.assertEqual(num, obj.num , name + " num=" + str(num) + \
                                              " != obj.num=" + str(obj.num))
         self.assertEqual(typ, "_or_".join(obj.format),
                          name + " " + "_or_".join(obj.format))
         self.assertEqual(name, obj.tostring(), name + " " + obj.tostring())
Esempio n. 2
0
 def test_files_are_being_opened(self):
     """Regression test for Fable"""
     for iframe, fname in enumerate(self.fnames):
         obj = fabio.FilenameObject(filename=fname)
         # read via the FilenameObject
         o1 = fabio.open(obj)
         self.assertEqual(o1.data.shape, self.datashape)
         self.assertEqual(o1.header['checkthing'], str(iframe))
         # And via the tostring
         o2 = fabio.open(obj.tostring())
         self.assertEqual(o2.data.shape, self.datashape)
         self.assertEqual(o2.header['checkthing'], str(iframe))
Esempio n. 3
0
 def test_FileNameObject_can_iterate(self):
     """Regression test for Fable"""
     obj = fabio.FilenameObject(filename=self.fnames[0])
     for iframe, fname in enumerate(self.fnames):
         obj.num = iframe
         # read via the FilenameObject
         o1 = fabio.open(obj)
         self.assertEqual(o1.data.shape, self.datashape)
         self.assertEqual(o1.header['checkthing'], str(iframe))
         # And via the tostring
         o2 = fabio.open(obj.tostring())
         self.assertEqual(o2.data.shape, self.datashape)
         self.assertEqual(o2.header['checkthing'], str(iframe))
         # And the real name
         o3 = fabio.open(fname)
         self.assertEqual(o3.data.shape, self.datashape)
         self.assertEqual(o3.header['checkthing'], str(iframe))