本文整理匯總了Python中airflow.contrib.hooks.gcp_vision_hook.CloudVisionHook.remove_product_from_product_set方法的典型用法代碼示例。如果您正苦於以下問題:Python CloudVisionHook.remove_product_from_product_set方法的具體用法?Python CloudVisionHook.remove_product_from_product_set怎麽用?Python CloudVisionHook.remove_product_from_product_set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類airflow.contrib.hooks.gcp_vision_hook.CloudVisionHook
的用法示例。
在下文中一共展示了CloudVisionHook.remove_product_from_product_set方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: execute
# 需要導入模塊: from airflow.contrib.hooks.gcp_vision_hook import CloudVisionHook [as 別名]
# 或者: from airflow.contrib.hooks.gcp_vision_hook.CloudVisionHook import remove_product_from_product_set [as 別名]
def execute(self, context):
hook = CloudVisionHook(gcp_conn_id=self.gcp_conn_id)
return hook.remove_product_from_product_set(
product_set_id=self.product_set_id,
product_id=self.product_id,
location=self.location,
project_id=self.project_id,
retry=self.retry,
timeout=self.timeout,
metadata=self.metadata,
)
示例2: TestGcpVisionHook
# 需要導入模塊: from airflow.contrib.hooks.gcp_vision_hook import CloudVisionHook [as 別名]
# 或者: from airflow.contrib.hooks.gcp_vision_hook.CloudVisionHook import remove_product_from_product_set [as 別名]
#.........這裏部分代碼省略.........
)
# Then
# Product ID was provided explicitly in the method call above, should be returned from the method
self.assertEqual(result, REFERENCE_IMAGE_GEN_ID_TEST)
create_reference_image_method.assert_called_once_with(
parent=PRODUCT_NAME,
reference_image=REFERENCE_IMAGE_TEST,
reference_image_id=REFERENCE_IMAGE_ID_TEST,
retry=None,
timeout=None,
metadata=None,
)
@mock.patch('airflow.contrib.hooks.gcp_vision_hook.CloudVisionHook.get_conn')
def test_add_product_to_product_set(self, get_conn):
# Given
add_product_to_product_set_method = get_conn.return_value.add_product_to_product_set
# When
self.hook.add_product_to_product_set(
product_set_id=PRODUCTSET_ID_TEST,
product_id=PRODUCT_ID_TEST,
location=LOC_ID_TEST,
project_id=PROJECT_ID_TEST,
)
# Then
# Product ID was provided explicitly in the method call above, should be returned from the method
add_product_to_product_set_method.assert_called_once_with(
name=PRODUCTSET_NAME_TEST, product=PRODUCT_NAME_TEST, retry=None, timeout=None, metadata=None
)
# remove_product_from_product_set
@mock.patch('airflow.contrib.hooks.gcp_vision_hook.CloudVisionHook.get_conn')
def test_remove_product_from_product_set(self, get_conn):
# Given
remove_product_from_product_set_method = get_conn.return_value.remove_product_from_product_set
# When
self.hook.remove_product_from_product_set(
product_set_id=PRODUCTSET_ID_TEST,
product_id=PRODUCT_ID_TEST,
location=LOC_ID_TEST,
project_id=PROJECT_ID_TEST,
)
# Then
# Product ID was provided explicitly in the method call above, should be returned from the method
remove_product_from_product_set_method.assert_called_once_with(
name=PRODUCTSET_NAME_TEST, product=PRODUCT_NAME_TEST, retry=None, timeout=None, metadata=None
)
@mock.patch('airflow.contrib.hooks.gcp_vision_hook.CloudVisionHook.annotator_client')
def test_annotate_image(self, annotator_client_mock):
# Given
annotate_image_method = annotator_client_mock.annotate_image
# When
self.hook.annotate_image(request=ANNOTATE_IMAGE_REQUEST)
# Then
# Product ID was provided explicitly in the method call above, should be returned from the method
annotate_image_method.assert_called_once_with(
request=ANNOTATE_IMAGE_REQUEST, retry=None, timeout=None
)
@mock.patch('airflow.contrib.hooks.gcp_vision_hook.CloudVisionHook.get_conn')
def test_create_product_explicit_id(self, get_conn):
# Given