def test_eoproduct_encode_protobuf(self): """Test encode method with protocol buffers encoding""" # Explicitly provide encoding product = EOProduct(self.provider, self.eoproduct_props, productType=self.product_type) encoded_raster = product.encode(self.raster, encoding="protobuf") self.assertIsInstance(encoded_raster, bytes) self.assertNotEqual(encoded_raster, b"")
def test_eoproduct_encode_bad_encoding(self): """EOProduct encode method must return an empty bytes if encoding is not supported or is None""" # noqa encoding = random.choice(["not_supported", None]) product = EOProduct(self.provider, self.eoproduct_props, productType=self.product_type) encoded_raster = product.encode(self.raster, encoding) self.assertIsInstance(encoded_raster, bytes) self.assertEqual(encoded_raster, b"")