@@ -43,12 +43,14 @@ def loop():
4343
4444@pytest .mark .parametrize ('use_async' , [(True ,), (False ,)])
4545@pytest .mark .parametrize ('configurations' , [
46+ None ,
47+ [],
4648 [
4749 ProcessRequestConfig (name = "config1" , value = "12490812.523" ),
4850 ProcessRequestConfig (name = "config1.1" , value = "stringvalue" ),
4951 ProcessRequestConfig (name = "config2" , bvalue = True ),
5052 ProcessRequestConfig (name = "config3" , bvalue = False ),
51- ]
53+ ],
5254])
5355def test_face_process_with_valid_image (
5456 use_async : bool ,
@@ -84,6 +86,91 @@ def test_face_process_with_valid_image(
8486 __template = detected_face .get ("template" )
8587
8688
89+ @pytest .mark .parametrize ('use_async' , [(True ,), (False ,)])
90+ @pytest .mark .parametrize ('processings' , [
91+ None ,
92+ ["detect" , "analyze" ],
93+ ["detect" , "templify" ],
94+ ["detect" , "analyze" , "templify" ],
95+ ])
96+ def test_face_process_processings (
97+ use_async : bool ,
98+ processings ,
99+ loop : asyncio .AbstractEventLoop
100+ ):
101+ """
102+ Test sync and async process request method when passed valid processings values.
103+ :param use_async: flag to use the async function
104+ :param loop: event loop for the current test
105+ :return:
106+ """
107+ try :
108+ if use_async :
109+ loop .run_until_complete (
110+ YKF .face .process_async (
111+ __image_file ,
112+ configurations = [],
113+ processings = processings ,
114+ )
115+ )
116+ else :
117+ YKF .face .process (__image_file )
118+ except YoonikApiException as exc :
119+ raise exc
120+
121+
122+ @pytest .mark .parametrize ('use_async' , [(True ,), (False ,)])
123+ @pytest .mark .parametrize ('processings' , [[]])
124+ def test_face_process_with_invalid_empty_processings (
125+ use_async : bool ,
126+ processings ,
127+ loop : asyncio .AbstractEventLoop
128+ ):
129+ """
130+ Test sync and async process request method when passed processings with empty values.
131+ :param use_async: flag to use the async function
132+ :param loop: event loop for the current test
133+ :return:
134+ """
135+ with pytest .raises (ValueError ):
136+ if use_async :
137+ loop .run_until_complete (
138+ YKF .face .process_async (
139+ __image_file ,
140+ configurations = [],
141+ processings = processings ,
142+ )
143+ )
144+ else :
145+ YKF .face .process (__image_file )
146+
147+
148+ @pytest .mark .parametrize ('use_async' , [(True ,), (False ,)])
149+ @pytest .mark .parametrize ('processings' , [1 , "2" , b"4" , dict (), set ()])
150+ def test_face_process_with_invalid_processings (
151+ use_async : bool ,
152+ processings ,
153+ loop : asyncio .AbstractEventLoop
154+ ):
155+ """
156+ Test sync and async process request method when passed processing of incorrect type.
157+ :param use_async: flag to use the async function
158+ :param loop: event loop for the current test
159+ :return:
160+ """
161+ with pytest .raises (TypeError ):
162+ if use_async :
163+ loop .run_until_complete (
164+ YKF .face .process_async (
165+ __image_file ,
166+ configurations = [],
167+ processings = processings ,
168+ )
169+ )
170+ else :
171+ YKF .face .process (__image_file )
172+
173+
87174@pytest .mark .parametrize ('use_async' , [(True ,), (False ,)])
88175@pytest .mark .parametrize ('configurations' , [
89176 [
0 commit comments