1
1
import pytest
2
2
3
3
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
10
5
6
+ from typing import List , Union
7
+ from DynamicTypesAnnotationsLibrary import DynamicTypesAnnotationsLibrary
8
+ from DynamicTypesAnnotationsLibrary import CustomObject
11
9
from DynamicTypesLibrary import DynamicTypesLibrary
12
10
13
11
@@ -70,44 +68,37 @@ def test_keyword_none_rf31(lib):
70
68
assert types == {}
71
69
72
70
73
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
74
71
def test_single_annotation (lib_types ):
75
72
types = lib_types .get_keyword_types ('keyword_with_one_annotation' )
76
73
assert types == {'arg' : str }
77
74
78
75
79
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
80
76
def test_multiple_annotations (lib_types ):
81
77
types = lib_types .get_keyword_types ('keyword_with_multiple_annotations' )
82
78
assert types == {'arg1' : str , 'arg2' : List }
83
79
84
80
85
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
86
81
def test_multiple_types (lib_types ):
87
82
types = lib_types .get_keyword_types ('keyword_multiple_types' )
88
83
assert types == {'arg' : Union [List , None ]}
89
84
90
85
91
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
92
86
def test_keyword_new_type (lib_types ):
93
87
types = lib_types .get_keyword_types ('keyword_new_type' )
94
88
assert len (types ) == 1
95
89
assert types ['arg' ]
96
90
97
91
98
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
99
92
def test_keyword_return_type (lib_types ):
100
93
types = lib_types .get_keyword_types ('keyword_define_return_type' )
101
94
assert types == {'arg' : str }
102
95
103
96
104
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
105
97
def test_keyword_forward_references (lib_types ):
106
98
types = lib_types .get_keyword_types ('keyword_forward_references' )
107
99
assert types == {'arg' : CustomObject }
108
100
109
101
110
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
111
102
def test_keyword_with_annotation_and_default (lib_types ):
112
103
types = lib_types .get_keyword_types ('keyword_with_annotations_and_default' )
113
104
assert types == {'arg' : str }
@@ -118,36 +109,30 @@ def test_keyword_with_many_defaults(lib):
118
109
assert types == {}
119
110
120
111
121
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
122
112
def test_keyword_with_annotation_external_class (lib_types ):
123
113
types = lib_types .get_keyword_types ('keyword_with_webdriver' )
124
114
assert types == {'arg' : CustomObject }
125
115
126
116
127
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
128
117
def test_keyword_with_annotation_and_default (lib_types ):
129
118
types = lib_types .get_keyword_types ('keyword_default_and_annotation' )
130
119
assert types == {'arg1' : int , 'arg2' : Union [bool , str ]}
131
120
132
121
133
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
134
122
def test_keyword_with_robot_types_and_annotations (lib_types ):
135
123
types = lib_types .get_keyword_types ('keyword_robot_types_and_annotations' )
136
124
assert types == {'arg' : str }
137
125
138
126
139
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
140
127
def test_keyword_with_robot_types_disbaled_and_annotations (lib_types ):
141
128
types = lib_types .get_keyword_types ('keyword_robot_types_disabled_and_annotations' )
142
129
assert types is None
143
130
144
131
145
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
146
132
def test_keyword_with_robot_types_and_bool_annotations (lib_types ):
147
133
types = lib_types .get_keyword_types ('keyword_robot_types_and_bool_hint' )
148
134
assert types == {'arg1' : str }
149
135
150
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
151
136
def test_init_args (lib_types ):
152
137
types = lib_types .get_keyword_types ('__init__' )
153
138
assert types == {'arg' : str }
@@ -163,85 +148,72 @@ def test_varargs(lib):
163
148
assert types == {}
164
149
165
150
166
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
167
151
def test_init_args_with_annotation (lib_types ):
168
152
types = lib_types .get_keyword_types ('__init__' )
169
153
assert types == {'arg' : str }
170
154
171
155
172
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
173
156
def test_exception_in_annotations (lib_types ):
174
157
types = lib_types .get_keyword_types ('keyword_exception_annotations' )
175
158
assert types == {'arg' : 'NotHere' }
176
159
177
160
178
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
179
161
def test_keyword_only_arguments (lib_types ):
180
162
types = lib_types .get_keyword_types ('keyword_only_arguments' )
181
163
assert types == {}
182
164
183
165
184
166
@pytest .mark .skipif (RF31 , reason = 'Only for RF3.2+' )
185
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
186
167
def test_keyword_only_arguments_many (lib_types ):
187
168
types = lib_types .get_keyword_types ('keyword_only_arguments_many' )
188
169
assert types == {}
189
170
190
171
191
172
@pytest .mark .skipif (not RF31 , reason = 'Only for RF3.1' )
192
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
193
173
def test_keyword_only_arguments_many (lib_types ):
194
174
types = lib_types .get_keyword_types ('keyword_only_arguments_many' )
195
175
assert types == {}
196
176
197
177
198
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
199
178
def test_keyword_mandatory_and_keyword_only_arguments (lib_types ):
200
179
types = lib_types .get_keyword_types ('keyword_mandatory_and_keyword_only_arguments' )
201
180
assert types == {'arg' : int , 'some' : bool }
202
181
203
182
204
183
@pytest .mark .skipif (RF31 , reason = 'Only for RF3.2+' )
205
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
206
184
def test_keyword_only_arguments_many_positional_and_default_rf32 (lib_types ):
207
185
types = lib_types .get_keyword_types ('keyword_only_arguments_many_positional_and_default' )
208
186
assert types == {'four' : Union [int , str ], 'six' : Union [bool , str ]}
209
187
210
188
211
189
@pytest .mark .skipif (not RF31 , reason = 'Only for RF3.1' )
212
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
213
190
def test_keyword_only_arguments_many_positional_and_default_rf31 (lib_types ):
214
191
types = lib_types .get_keyword_types ('keyword_only_arguments_many_positional_and_default' )
215
192
assert types == {'four' : Union [int , str ], 'six' : Union [bool , str ]}
216
193
217
194
218
195
@pytest .mark .skipif (RF31 , reason = 'Only for RF3.2+' )
219
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
220
196
def test_keyword_all_args_rf32 (lib_types ):
221
197
types = lib_types .get_keyword_types ('keyword_all_args' )
222
198
assert types == {}
223
199
224
200
225
201
@pytest .mark .skipif (not RF31 , reason = 'Only for RF3.1' )
226
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
227
202
def test_keyword_all_args_rf31 (lib_types ):
228
203
types = lib_types .get_keyword_types ('keyword_all_args' )
229
204
assert types == {}
230
205
231
206
232
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
233
207
def test_keyword_self_and_types (lib_types ):
234
208
types = lib_types .get_keyword_types ('keyword_self_and_types' )
235
209
assert types == {'mandatory' : str , 'other' : bool }
236
210
237
211
238
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
239
212
def test_keyword_self_and_keyword_only_types (lib_types ):
240
213
types = lib_types .get_keyword_types ('keyword_self_and_keyword_only_types' )
241
214
assert types == {'varargs' : int , 'other' : bool , 'kwargs' : int }
242
215
243
216
244
- @pytest .mark .skipif (PY2 , reason = 'Only applicable on Python 3' )
245
217
def test_keyword_with_decorator_arguments (lib_types ):
246
218
types = lib_types .get_keyword_types ('keyword_with_deco_and_signature' )
247
219
assert types == {'arg1' : bool , 'arg2' : bool }
0 commit comments