def test_read_metadata_only(self): tiff.write(self.filename, self.image) metadata = tiff.info(self.filename) expected = METADATA.copy() expected.update({ 'conjugates': list(CHANNELS), 'date': datetime.datetime.strptime(expected['date'], '%Y-%m-%dT%H:%M:%S') }) self.assertEqual(metadata, expected)
def test_read_metadata_with_user_defined_metadata(self): tiff.write(self.filename, self.image_user_defined_metadata) metadata = tiff.info(self.filename) expected = METADATA.copy() expected.update({ 'conjugates': list(CHANNELS), 'date': datetime.datetime.strptime(expected['date'], '%Y-%m-%dT%H:%M:%S'), **USER_DEFINED_METADATA }) self.assertEqual(metadata, expected)
def test_read_old_mibiscope_metadata(self): tiff.write(self.filename, self.image_old_mibiscope_metadata) metadata = tiff.info(self.filename) expected = OLD_MIBISCOPE_METADATA.copy() expected.update({ 'conjugates': list(CHANNELS), 'aperture': 'B', 'date': datetime.datetime.strptime(expected['date'], '%Y-%m-%dT%H:%M:%S'), }) self.assertEqual(metadata, expected)
def test_open_file_with_old_metadata(self): metadata = tiff.info(OLD_TIFF_FILE) expected = METADATA.copy() expected.update({ 'conjugates': list(CHANNELS), 'aperture': 'B', 'date': datetime.datetime.strptime(expected['date'], '%Y-%m-%dT%H:%M:%S'), }) del expected['description'] del expected['version'] self.assertEqual(metadata, expected)
def test_read_old_metadata(self): tiff.write(self.filename, self.image_old_metadata) metadata = tiff.info(self.filename) expected = METADATA.copy() expected.update({ 'point_name': OLD_METADATA['point_name'], 'conjugates': list(CHANNELS), 'date': datetime.datetime.strptime(expected['date'], '%Y-%m-%dT%H:%M:%S'), 'description': None, 'version': None }) self.assertEqual(metadata, expected)