11import pytest
22
33
4- from robotlibcore import PY2 , RF31
5-
6- if not PY2 :
7- from typing import List , Union , Dict
8- from DynamicTypesAnnotationsLibrary import DynamicTypesAnnotationsLibrary
9- from DynamicTypesAnnotationsLibrary import CustomObject
4+ from robotlibcore import RF31
105
6+ from typing import List , Union
7+ from DynamicTypesAnnotationsLibrary import DynamicTypesAnnotationsLibrary
8+ from DynamicTypesAnnotationsLibrary import CustomObject
119from DynamicTypesLibrary import DynamicTypesLibrary
1210
1311
@@ -70,44 +68,37 @@ def test_keyword_none_rf31(lib):
7068 assert types == {}
7169
7270
73- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
7471def test_single_annotation (lib_types ):
7572 types = lib_types .get_keyword_types ('keyword_with_one_annotation' )
7673 assert types == {'arg' : str }
7774
7875
79- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
8076def test_multiple_annotations (lib_types ):
8177 types = lib_types .get_keyword_types ('keyword_with_multiple_annotations' )
8278 assert types == {'arg1' : str , 'arg2' : List }
8379
8480
85- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
8681def test_multiple_types (lib_types ):
8782 types = lib_types .get_keyword_types ('keyword_multiple_types' )
8883 assert types == {'arg' : Union [List , None ]}
8984
9085
91- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
9286def test_keyword_new_type (lib_types ):
9387 types = lib_types .get_keyword_types ('keyword_new_type' )
9488 assert len (types ) == 1
9589 assert types ['arg' ]
9690
9791
98- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
9992def test_keyword_return_type (lib_types ):
10093 types = lib_types .get_keyword_types ('keyword_define_return_type' )
10194 assert types == {'arg' : str }
10295
10396
104- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
10597def test_keyword_forward_references (lib_types ):
10698 types = lib_types .get_keyword_types ('keyword_forward_references' )
10799 assert types == {'arg' : CustomObject }
108100
109101
110- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
111102def test_keyword_with_annotation_and_default (lib_types ):
112103 types = lib_types .get_keyword_types ('keyword_with_annotations_and_default' )
113104 assert types == {'arg' : str }
@@ -118,36 +109,30 @@ def test_keyword_with_many_defaults(lib):
118109 assert types == {}
119110
120111
121- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
122112def test_keyword_with_annotation_external_class (lib_types ):
123113 types = lib_types .get_keyword_types ('keyword_with_webdriver' )
124114 assert types == {'arg' : CustomObject }
125115
126116
127- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
128117def test_keyword_with_annotation_and_default (lib_types ):
129118 types = lib_types .get_keyword_types ('keyword_default_and_annotation' )
130119 assert types == {'arg1' : int , 'arg2' : Union [bool , str ]}
131120
132121
133- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
134122def test_keyword_with_robot_types_and_annotations (lib_types ):
135123 types = lib_types .get_keyword_types ('keyword_robot_types_and_annotations' )
136124 assert types == {'arg' : str }
137125
138126
139- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
140127def test_keyword_with_robot_types_disbaled_and_annotations (lib_types ):
141128 types = lib_types .get_keyword_types ('keyword_robot_types_disabled_and_annotations' )
142129 assert types is None
143130
144131
145- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
146132def test_keyword_with_robot_types_and_bool_annotations (lib_types ):
147133 types = lib_types .get_keyword_types ('keyword_robot_types_and_bool_hint' )
148134 assert types == {'arg1' : str }
149135
150- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
151136def test_init_args (lib_types ):
152137 types = lib_types .get_keyword_types ('__init__' )
153138 assert types == {'arg' : str }
@@ -163,85 +148,72 @@ def test_varargs(lib):
163148 assert types == {}
164149
165150
166- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
167151def test_init_args_with_annotation (lib_types ):
168152 types = lib_types .get_keyword_types ('__init__' )
169153 assert types == {'arg' : str }
170154
171155
172- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
173156def test_exception_in_annotations (lib_types ):
174157 types = lib_types .get_keyword_types ('keyword_exception_annotations' )
175158 assert types == {'arg' : 'NotHere' }
176159
177160
178- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
179161def test_keyword_only_arguments (lib_types ):
180162 types = lib_types .get_keyword_types ('keyword_only_arguments' )
181163 assert types == {}
182164
183165
184166@pytest .mark .skipif (RF31 , reason = 'Only for RF3.2+' )
185- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
186167def test_keyword_only_arguments_many (lib_types ):
187168 types = lib_types .get_keyword_types ('keyword_only_arguments_many' )
188169 assert types == {}
189170
190171
191172@pytest .mark .skipif (not RF31 , reason = 'Only for RF3.1' )
192- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
193173def test_keyword_only_arguments_many (lib_types ):
194174 types = lib_types .get_keyword_types ('keyword_only_arguments_many' )
195175 assert types == {}
196176
197177
198- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
199178def test_keyword_mandatory_and_keyword_only_arguments (lib_types ):
200179 types = lib_types .get_keyword_types ('keyword_mandatory_and_keyword_only_arguments' )
201180 assert types == {'arg' : int , 'some' : bool }
202181
203182
204183@pytest .mark .skipif (RF31 , reason = 'Only for RF3.2+' )
205- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
206184def test_keyword_only_arguments_many_positional_and_default_rf32 (lib_types ):
207185 types = lib_types .get_keyword_types ('keyword_only_arguments_many_positional_and_default' )
208186 assert types == {'four' : Union [int , str ], 'six' : Union [bool , str ]}
209187
210188
211189@pytest .mark .skipif (not RF31 , reason = 'Only for RF3.1' )
212- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
213190def test_keyword_only_arguments_many_positional_and_default_rf31 (lib_types ):
214191 types = lib_types .get_keyword_types ('keyword_only_arguments_many_positional_and_default' )
215192 assert types == {'four' : Union [int , str ], 'six' : Union [bool , str ]}
216193
217194
218195@pytest .mark .skipif (RF31 , reason = 'Only for RF3.2+' )
219- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
220196def test_keyword_all_args_rf32 (lib_types ):
221197 types = lib_types .get_keyword_types ('keyword_all_args' )
222198 assert types == {}
223199
224200
225201@pytest .mark .skipif (not RF31 , reason = 'Only for RF3.1' )
226- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
227202def test_keyword_all_args_rf31 (lib_types ):
228203 types = lib_types .get_keyword_types ('keyword_all_args' )
229204 assert types == {}
230205
231206
232- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
233207def test_keyword_self_and_types (lib_types ):
234208 types = lib_types .get_keyword_types ('keyword_self_and_types' )
235209 assert types == {'mandatory' : str , 'other' : bool }
236210
237211
238- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
239212def test_keyword_self_and_keyword_only_types (lib_types ):
240213 types = lib_types .get_keyword_types ('keyword_self_and_keyword_only_types' )
241214 assert types == {'varargs' : int , 'other' : bool , 'kwargs' : int }
242215
243216
244- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
245217def test_keyword_with_decorator_arguments (lib_types ):
246218 types = lib_types .get_keyword_types ('keyword_with_deco_and_signature' )
247219 assert types == {'arg1' : bool , 'arg2' : bool }
0 commit comments