text: import h5py
  import unittest
  from click.testing import CliRunner
  from singl.testing.helpers import create_test_csv_from_ids
  from singl.testing.helpers import create_test_images
  
  from singl.scripts.compress_dataset import compress_dataset
  
  
  class TestCompressDataset(unittest.TestCase):
  
      def setUp(self):
          self.TEST_ID = "1a2b3c"
          self.TEST_IDS = ["1a", "2b", "3c"]
          self.TEST_DIR = "demo_dir"
          self.TEST_CSV = "demo.csv"
          self.TEST_OUTPUT = "demo.hdf5"
  
      def test_compress_single_image(self):
          runner = CliRunner()
          with runner.isolated_filesystem():
              create_test_csv_from_ids(self.TEST_ID, self.TEST_CSV)
              create_test_images(self.TEST_ID, self.TEST_DIR)
              result = runner.invoke(compress_dataset,
                                     [self.TEST_CSV, self.TEST_DIR, self.TEST_OUTPUT])
              self.assertEqual(result.exit_code, 0)
              with h5py.File(self.TEST_OUTPUT, "r") as db:
                  image = db[self.TEST_ID]
                  self.assertEqual(image.shape, (10, 10, 4))
  
      def test_compress_dataset(self):
          runner = CliRunner()
          with runner.isolated_filesystem():
              create_test_csv_from_ids(self.TEST_IDS, self.TEST_CSV)
              create_test_images(self.TEST_IDS, self.TEST_DIR)
              result = runner.invoke(compress_dataset,
                                     [self.TEST_CSV, self.TEST_DIR, self.TEST_OUTPUT])
              self.assertEqual(result.exit_code, 0)
              with h5py.File(self.TEST_OUTPUT, "r") as db:
                  image = db[self.TEST_IDS[0]]
                  self.assertEqual(image.shape, (10, 10, 4))
  
  
  if __name__ == '__main__':
      unittest.main()
  