Example #1
0
 def test_with_bad_param_types(self):
     # test with bad topdir
     with self.assertRaises(ValueError):
         list(all_files_with_ext(12, "xyz"))
     # test with bad topdir
     with self.assertRaises(ValueError):
         list(all_files_with_ext(".", 31))
     # test with bad cs
     with self.assertRaises(ValueError):
         list(all_files_with_ext(".", "jpg", cs="No"))
Example #2
0
 def test_with_timestream_ext_jpg_cs(self):
     res = all_files_with_ext(helpers.FILES["timestream_manifold"], "jpg",
                              cs=True)
     self.assertTrue(isgenerator(res))
     res = sorted(list(res))
     self.assertListEqual(res, [])
     res = all_files_with_ext(helpers.FILES["timestream_manifold"], "JPG",
                              cs=True)
     res = sorted(list(res))
     self.assertListEqual(res, helpers.TS_MANIFOLD_FILES_JPG)
Example #3
0
    def iter_by_files(self, ignored_timestamps=[]):
        for fpath in all_files_with_ext(
                self.path, self.extension, cs=False):
            img = TimeStreamImage()
            img.parent_timestream = self
            img.path = fpath
            img_date = ts_format_date(img.datetime)

            # skip images in ignored_timestamps
            if img_date in ignored_timestamps:
                LOG.info("Skip processing data at {}".format(img.datetime))
                continue

            try:
                img.data = self.image_data[img_date]
            except KeyError:
                img.data = {}
            yield img
Example #4
0
 def test_with_emptydir_ext_xyz(self):
     res = all_files_with_ext(helpers.FILES["empty_dir"], "xyz")
     self.assertTrue(isgenerator(res))
     res = sorted(list(res))
     self.assertListEqual(res, [])
Example #5
0
 def test_with_timestream_ext_xyz(self):
     res = all_files_with_ext(helpers.FILES["timestream_manifold"], "xyz")
     self.assertTrue(isgenerator(res))
     res = sorted(list(res))
     self.assertListEqual(res, [])
Example #6
0
 def test_with_timestream_ext_jpggccaps(self):
     res = all_files_with_ext(helpers.FILES["timestream"], "JPG")
     self.assertTrue(isgenerator(res))
     res = list(res)
     self.assertListEqual(res, helpers.TS_FILES_JPG)