1
1
import pytest
2
2
3
3
4
- from robotlibcore import PY2
4
+ from robotlibcore import PY2 , RF31
5
5
6
6
if not PY2 :
7
7
from typing import List , Union , Dict
@@ -31,11 +31,18 @@ def test_types_disabled(lib):
31
31
assert types is None
32
32
33
33
34
- def test_keyword_types_and_bool_default (lib ):
34
+ @pytest .mark .skipif (not RF31 , reason = 'Only for RF3.1' )
35
+ def test_keyword_types_and_bool_default_rf31 (lib ):
35
36
types = lib .get_keyword_types ('keyword_robot_types_and_bool_default' )
36
37
assert types == {'arg1' : str , 'arg2' : bool }
37
38
38
39
40
+ @pytest .mark .skipif (RF31 , reason = 'Only for RF3.2+' )
41
+ def test_keyword_types_and_bool_default_rf32 (lib ):
42
+ types = lib .get_keyword_types ('keyword_robot_types_and_bool_default' )
43
+ assert types == {'arg1' : str }
44
+
45
+
39
46
def test_one_keyword_type_defined (lib ):
40
47
types = lib .get_keyword_types ('keyword_with_one_type' )
41
48
assert types == {'arg1' : str }
@@ -51,12 +58,26 @@ def test_not_keyword(lib):
51
58
lib .get_keyword_types ('not_keyword' )
52
59
53
60
54
- def test_keyword_booleans (lib ):
61
+ @pytest .mark .skipif (not RF31 , reason = 'Only for RF3.2+' )
62
+ def test_keyword_booleans_rf31 (lib ):
55
63
types = lib .get_keyword_types ('keyword_booleans' )
56
64
assert types == {'arg1' : bool , 'arg2' : bool }
57
65
58
66
59
- def test_keyword_none (lib ):
67
+ @pytest .mark .skipif (RF31 , reason = 'Only for RF3.2+' )
68
+ def test_keyword_booleans_rf32 (lib ):
69
+ types = lib .get_keyword_types ('keyword_booleans' )
70
+ assert types == {}
71
+
72
+
73
+ @pytest .mark .skipif (RF31 , reason = 'Only for RF3.2+' )
74
+ def test_keyword_none_rf32 (lib ):
75
+ types = lib .get_keyword_types ('keyword_none' )
76
+ assert types == {}
77
+
78
+
79
+ @pytest .mark .skipif (not RF31 , reason = 'Only for RF3.2+' )
80
+ def test_keyword_none_rf31 (lib ):
60
81
types = lib .get_keyword_types ('keyword_none' )
61
82
assert types == {'arg' : type (None )}
62
83
@@ -79,11 +100,6 @@ def test_multiple_types(lib_types):
79
100
assert types == {'arg' : Union [List , None ]}
80
101
81
102
82
- def test_keyword_with_default_type (lib ):
83
- types = lib .get_keyword_types ('keyword_default_types' )
84
- assert types == {'arg' : type (None )}
85
-
86
-
87
103
@pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
88
104
def test_keyword_new_type (lib_types ):
89
105
types = lib_types .get_keyword_types ('keyword_new_type' )
@@ -123,7 +139,7 @@ def test_keyword_with_annotation_external_class(lib_types):
123
139
@pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
124
140
def test_keyword_with_annotation_and_default (lib_types ):
125
141
types = lib_types .get_keyword_types ('keyword_default_and_annotation' )
126
- assert types == {'arg1' : int , 'arg2' : bool }
142
+ assert types == {'arg1' : int , 'arg2' : Union [ bool , str ] }
127
143
128
144
129
145
@pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
@@ -140,13 +156,13 @@ def test_keyword_with_robot_types_disbaled_and_annotations(lib_types):
140
156
141
157
@pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
142
158
def test_keyword_with_robot_types_and_bool_annotations (lib_types ):
143
- types = lib_types .get_keyword_types ('keyword_robot_types_and_bool_defaults' )
144
- assert types == {'arg1' : str , 'arg2' : bool }
145
-
159
+ types = lib_types .get_keyword_types ('keyword_robot_types_and_bool_hint' )
160
+ assert types == {'arg1' : str }
146
161
147
- def test_init_args (lib ):
148
- types = lib .get_keyword_types ('__init__' )
149
- assert types == {'arg' : bool }
162
+ @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
163
+ def test_init_args (lib_types ):
164
+ types = lib_types .get_keyword_types ('__init__' )
165
+ assert types == {'arg' : str }
150
166
151
167
152
168
def test_dummy_magic_method (lib ):
@@ -177,26 +193,50 @@ def test_keyword_only_arguments(lib_types):
177
193
assert types == {}
178
194
179
195
196
+ @pytest .mark .skipif (RF31 , reason = 'Only for RF3.2+' )
180
197
@pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
181
198
def test_keyword_only_arguments_many (lib_types ):
182
199
types = lib_types .get_keyword_types ('keyword_only_arguments_many' )
183
- assert types == {'other' : type ( None ) }
200
+ assert types == {}
184
201
185
202
203
+ @pytest .mark .skipif (not RF31 , reason = 'Only for RF3.1' )
186
204
@pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
187
205
def test_keyword_only_arguments_many (lib_types ):
206
+ types = lib_types .get_keyword_types ('keyword_only_arguments_many' )
207
+ assert types == {'other' : type (None )}
208
+
209
+
210
+ @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
211
+ def test_keyword_mandatory_and_keyword_only_arguments (lib_types ):
188
212
types = lib_types .get_keyword_types ('keyword_mandatory_and_keyword_only_arguments' )
189
213
assert types == {'arg' : int , 'some' : bool }
190
214
191
215
216
+ @pytest .mark .skipif (RF31 , reason = 'Only for RF3.2+' )
192
217
@pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
193
- def test_keyword_only_arguments_many (lib_types ):
218
+ def test_keyword_only_arguments_many_positional_and_default_rf32 (lib_types ):
194
219
types = lib_types .get_keyword_types ('keyword_only_arguments_many_positional_and_default' )
195
- assert types == {'four' : bool , 'five' : type (None ), 'six' : bool }
220
+ assert types == {'four' : Union [int , str ], 'six' : Union [bool , str ]}
221
+
222
+
223
+ @pytest .mark .skipif (not RF31 , reason = 'Only for RF3.1' )
224
+ @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
225
+ def test_keyword_only_arguments_many_positional_and_default_rf31 (lib_types ):
226
+ types = lib_types .get_keyword_types ('keyword_only_arguments_many_positional_and_default' )
227
+ assert types == {'four' : Union [int , str ], 'five' : type (None ), 'six' : Union [bool , str ]}
228
+
229
+
230
+ @pytest .mark .skipif (RF31 , reason = 'Only for RF3.2+' )
231
+ @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
232
+ def test_keyword_all_args_rf32 (lib_types ):
233
+ types = lib_types .get_keyword_types ('keyword_all_args' )
234
+ assert types == {}
196
235
197
236
237
+ @pytest .mark .skipif (not RF31 , reason = 'Only for RF3.1' )
198
238
@pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
199
- def test_keyword_all_args (lib_types ):
239
+ def test_keyword_all_args_rf31 (lib_types ):
200
240
types = lib_types .get_keyword_types ('keyword_all_args' )
201
241
assert types == {'value' : bool }
202
242
0 commit comments