def test_serializer_save_and_load_info(self): input_info = {'info': 'example'} Serializer.save(self.image1, 'test_serializer_save_and_load_data.pkl', info=input_info) info = Deserializer.info('test_serializer_save_and_load_data.pkl') self.assertEqual(info['info'], input_info['info'])
def test_serializer_save_and_load_key(self): input_key = {'test_key': 'key_val'} Serializer.save(self.image1, 'test_serializer_save_and_load_data.pkl', key=input_key) key = Deserializer.key('test_serializer_save_and_load_data.pkl') self.assertEqual(key, input_key)
def test_serializer_save_no_file_extension(self): Serializer.save(self.image1, 'test_serializer_save_no_ext', info={'info': 'example'}, key={1: 2}) if 'test_serializer_save_no_ext.pkl' not in os.listdir('.'): raise AssertionError( 'File test_serializer_save_no_ext.pkl not found')
def test_serializer_save_and_load_info(self): input_info = {'info':'example'} Serializer.save(self.image1, 'test_serializer_save_and_load_data.pkl', info=input_info) info = Deserializer.info('test_serializer_save_and_load_data.pkl') self.assertEqual(info['info'], input_info['info'])
def test_serializer_save_and_load_key(self): input_key = {'test_key':'key_val'} Serializer.save(self.image1, 'test_serializer_save_and_load_data.pkl', key=input_key) key = Deserializer.key('test_serializer_save_and_load_data.pkl') self.assertEqual(key, input_key)
def test_serializer_save_and_load_data_2(self): Serializer.save(self.image2, 'test_serializer_save_and_load_data_2.pkl') loaded = Deserializer.load('test_serializer_save_and_load_data_2.pkl') self.assertEqual(loaded, self.image2)
def test_serializer_save_no_file_extension(self): Serializer.save(self.image1, 'test_serializer_save_no_ext', info={'info':'example'}, key={1:2}) if 'test_serializer_save_no_ext.pkl' not in os.listdir('.'): raise AssertionError('File test_serializer_save_no_ext.pkl not found')
def test_serializer_save(self): Serializer.save(self.image1, 'test_serializer_save.pkl', info={'info':'example'}, key={1:2})